9.6. Subroutines

Example 9-7. examples/subroutines/multiple_same_name_params.p6

#!/usr/bin/perl6
use v6;

# TODO named parameters
f(1, 4);           # 1  4
#f(y => 6, x => 2); # 2  6
#f(2, y => 6);      # 2  6
#f(2, x => 6);      # 6  2

sub f($x, $y) {
    say "$x $y";
}

sub u($x, $y?) {
}

sub x($x, $y = 7) {
}



If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed