Course of Raku / Essentials / More about types / 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?

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

2

The program is run as:

$ raku t.raku "hello world"

What are the values printed?

1say @*ARGS.elems; prints  (: 1, 2 :)The quoted string is a single argument.
hello worldsay @*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?

2say @*ARGS.elems; prints  (: 1, 2 :)
hellosay @*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

The @*ARGS array   |   Interpolating arrays

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