Type conversion for typed variables
Type constraints are strict enough. For instance, you cannot assign a
Num value, even if it contains a whole integer, to a variable declared as
my Int $x = 42; # $x = 42e1; # Error
Use one of the methods to cast the value.
my Int $x = 42; $x = 42e1.Int; $x = Int(42e1);
Complete the quiz that covers the contents of this topic.
💪 Or jump directly to the exercises to this section.