Course of Raku / Essentials / Positional data types / The @*ARGS array

Quiz — The @*ARGS array

You are running the following program a few times. For each run, find the correct answers.

The program is saved in the file t.raku and has the following code:

say @*ARGS.elems;
say @*ARGS[0];

1

The program is run as:

$ raku t.raku hello world

What are the values printed by each of the lines of code?

2 say @*ARGS.elems; prints  (: 1, 2 :)
hello say @*ARGS[0]; prints  (: hello, world, hello world :)

2

The program is run as:

$ raku t.raku "hello world"

What are the values printed?

1 say @*ARGS.elems; prints  (: 1, 2 :) The quoted string is a single argument.
hello world say @*ARGS[0]; prints  (: hello, "hello", world, "world", hello world, "hello world" :)  

3

The program is run as:

$ raku t.raku "hello" "world"

What does it print?

2 say @*ARGS.elems; prints  (: 1, 2 :)  
hello say @*ARGS[0]; prints  (: hello, "hello", world, "world", hello world, "hello world" :) The quotes from the shell are not included in the value of the argument.

Course navigation

Positional data types / Nested arrays   |   Positional data types / Interpolating arrays


💪 Or jump directly to the exercises to this section.

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська