Course of Raku / Essentials / Creating and calling functions / Positional parameters

Quiz — Calling a function

1

Having the following function:

sub abc($a, $b, $c) {
    return $a ~ $b ~ $c;
}

How do you call it?

, , say abc($a␣ $b␣ $c);
= my $s ␣ abc('a', 'b', 'c');
= abc ) my $z ␣ ␣␣␣($a, $b, $c␣;
, , say abc $a␣ $b␣ $c;

2

For the following function:

sub x {
    return 42;
}

Select the correct calls of it.

1 say x;  
1 say(x);  
1 say x(); Parenthese around the arguments of say are ommited.
1 say(x());  
0 my $v = x (); A space before () makes the () an argument.
1 my $w = x();  
1 my $u = x;  

Course navigation

Creating and calling functions / Returning the result   |   Creating and calling functions / Named parameters


💪 Or jump directly to the exercises to this section.