Course of Raku / Essentials / The MAIN function / Reading command-line arguments

Quiz — Default values

Consider the following program.

sub MAIN($a = 'abc', $b = 'def') {
    say $a;
    say $b;
}

1

What does it print if it is run as shown below?

$ raku t.raku
abc def Enter the output values: ␣␣␣ and ␣␣␣

2

Now, the same program is run as:

$ raku t.raku xyz
xyz def Enter the output values: ␣␣␣ and ␣␣␣

3

Finally, this command:

$ raku t.raku xyz 123
xyz 123 Enter the output values: ␣␣␣ and ␣␣␣

Course navigation

The MAIN function   |   The MAIN function / Multiple MAIN functions


💪 Or jump directly to the exercises to this section.

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