Cursus Raku / Elementa / Positionalia data genera / @*ARGS
array
Quiz — @*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. |
Cursus navigatio
← Positionalia data genera / Nidificata array | Positionalia data genera / Interpolando array →
💪 Or jump directly to the exercises to this section.
Haec pagina automatice translata est per ChatGPT 4o. Originalis Anglicus textus
Translationes huius paginae: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська