Named parameters

Raku's support for optional parameters is much like Python's. Consider this declaration:

sub funkshun ($a, $b?, $c = 15, :$d, *@e, *%f) {
   ...
}

In the above signature:

So, if we defined the function like this:

sub funkshun ($a, $b?, :$c = 15, :$d, *@e, *%f) {
   say "$a $b $c $d";
   say join ' ', @e;
   say join ' ', keys %f;
}

# this particularly thorny call:

funkshun
    'Alfa', k1 => 'v1', c => 'Charlie', 'Bravo', 'e1',
    d => 'Delta', 'e2', k2 => 'v2';

would print this:

Alfa Bravo Charlie Delta
e1 e2
k1 k2

Last updated