Course of Raku / Essentials / Creating and calling functions

Positional parameters

The order of function parameters is important. For example, create a function that computes the difference between two numbers:

sub diff($a, $b) { $a - $b }

It is obvious that the result of calling diff(10, 20) differs from diff(20, 10).

Parameters that are listed as a comma-separated list like in the function above are called positional. Their meaning depends on the order in which the arguments are passed to the function when it is called.


Complete the quiz that covers the contents of this topic.

Course navigation

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

💪 Or jump directly to the exercises to this section.