user
Create a function which takes in a number of arguments which are specified by name rather than (necessarily) position, and show how to call the function. If the language supports reordering the arguments or optionally omitting some of them, note this.

**Note:**

:   Named parameters relies on being able to use the names given to function parameters when the function is defined, when assigning arguments when the function is called.
:   For example, if a function were to be defined as `define func1( paramname1, paramname2)`; then it could be called normally as `func1(argument1, argument2)` and in the called function paramname1 would be associated with argument1 and paramname2 with argument2.
:   `func1` **must also be able to be called in a way that visually binds each parameter to its respective argument, irrespective of argument order**, for example: `func1(paramname2=argument2, paramname1=argument1)` which *explicitly* makes the same parameter/argument bindings as before.
:   Named parameters are often a feature of languages used in safety critical areas such as Verilog and VHDL.

**See also:**

* Varargs
* Optional parameters
* Wikipedia: Named parameter
assistant
(formerly Perl 6)

**Works with**: Rakudo version #22 "Thousand Oaks"

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:

* `$a` is a mandatory parameter accepted by position (`funkshun 15, ...`).
* `$b` is an optional parameter that can be passed by position or by name. By default, it's undefined.
* `$c` is an optional parameter that can be passed by position or by name. Its default value is `15`.
* `$d` is an optional parameter that can only be passed by name. By default, it's undefined.
* `@e` is a slurpy array: it receives any leftover positional arguments.
* `%f` is a slurpy hash: it receives any leftover named arguments.

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
```