Course of Raku / Essentials
/ Data type conversion / Introspection with
WHAT
Quiz: What does WHAT return?
Select the correct result of calling the WHAT
method.
| (Str) | 'String'.WHAT returns (: (Int), (Rat), (Num), (Str) :) | |
| (Int) | 500.WHAT returns (: (Int), (Rat), (Num), (Str) :) | |
| (Rat) | 3.14.WHAT returns (: (Int), (Rat), (Num), (Str) :) | Two dots should not confuse you. |
| (Num) | pi.WHAT returns (: (Int), (Rat), (Num), (Str) :) | pi is Num by definition. |
| (Int) | (-10).WHAT returns (: (Int), (Rat), (Num), (Str) :) | |
| (Int) | (+10).WHAT returns (: (Int), (Rat), (Num), (Str) :) | |
| (Rat) | (-1/2).WHAT returns (: (Int), (Rat), (Num), (Str) :) | |
| (Int) | ('3' + '4').WHAT returns (: (Int), (Rat), (Num), (Str) :) | '3' + '4' does numeric addition, so the result is integer. |
| (Str) | ('3' ~ '4').WHAT returns (: (Int), (Rat), (Num), (Str) :) | String concatenation gives a string. |
Course navigation
← Introspection with
WHAT | Converting types using type coercion
methods →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська