Course of Raku / Advanced / Subroutines / More on MAIN subroutines / Exercises / Add two arguments
Solution: Add two arguments
Here is a possible solution to the task.
Code
sub MAIN($a, $b) {
say $a + $b;
}🦋 You can find the source code in the file two-arguments.raku.
Output
$ raku two-arguments.raku 2 3
5Comments
The two positional parameters receive the two words from the command line.
Command-line arguments arrive as strings, but the
+operator converts them to numbers, so2and3add up to5.