Course of Raku / Essentials / Creating and calling functions / Default values

Quiz — Functions with default values

What is the result of calling the following function with different arguments?

sub f($a, $b = 4, $c = 5) {
    $a + $b + $c
}
10f(1) returns  (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 :)
8f(1, 2) returns  (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 :)
6f(1, 2, 3) returns  (: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 :)

Course navigation

Quiz — Defining default values   |   Function to compute

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська