Course of Raku / Essentials / More about functions / Multi-functions

Quiz 3 — Calling multi-functions

Here are the three variants of the function.

multi sub func(Int $a) { 1 }
multi sub func(Rat $a) { 2 }
multi sub func(Num $a) { 3 }

Which calls are valid?

  func(4)
  func(4e4)
  func(4/4)
  func('4')
  func(4.4)

What do the calls return?

  1 func(4) returns 
  2 func(4.4) returns 
  2 func(4/4) returns 
  3 func(4e4) returns 

Course navigation

More about functions / Return type   |   💪 Exercise: Factorial with multi-functions

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