Course of Raku / Essentials / Functions 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 defEnter the output values: ␣␣␣ and ␣␣␣

2

Now, the same program is run as:

$ raku t.raku xyz
xyz defEnter the output values: ␣␣␣ and ␣␣␣

3

Finally, this command:

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

Course navigation

Quiz — Reading command-line arguments   |   Multiple MAIN functions

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