Course of Raku / Essentials / More about types / Data type conversion

Quiz: What is its type?

Select the correct type for each of the listed literals.

Str"Hello, World!" is (: Int, Rat, Num, Str :)
Str'Hello, World!' is (: Int, Rat, Num, Str :)
Int12345 is (: Int, Rat, Num, Str :)
Str'12345' is (: Int, Rat, Num, Str :)
Rat123.45 is (: Int, Rat, Num, Str :)This is a rational number in Raku, not a floating-point number.
Rat500.000 is (: Int, Rat, Num, Str :)Even if the number has no actual decimal part, its type is not Int.
Int500_000 is (: Int, Rat, Num, Str :)_ is a thousands separator for easier reading by a human.
Str'3.14e2' is (: Int, Rat, Num, Str :)This is a quoted sequence of characters, so it is a string.
Rat3.14 is (: Int, Rat, Num, Str :)
Num3.14e0 is (: Int, Rat, Num, Str :)

Course navigation

Solution: Fractional part   |   Typed variables

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