Course of Raku / Essentials / Positional data types / Exercises / The number of command-line arguments

Solution: The number of command-line arguments

The solution is quite simple.


say @*ARGS.elems;

Alternatively, you can chain all the methods:


🦋 Find the program in the file number-of-command-line-arguments.raku.


This program requires a test of two cases:

  1. No arguments passed.
  2. Some non-zero number of arguments passed.
$ raku exercises/positionals/number-of-command-line-arguments.raku

$ raku exercises/positionals/number-of-command-line-arguments.raku one 2 three 4 five 6 seven

Next exercise

💪 Print command-line arguments

Course navigation

Typed variables / Allomorphs   |   Associative data types