Course of Raku / Essentials / More about types / Typed variables

Using of

Here is another possible syntax to restrict the type of the scalar container:

my $var of Int;
my $str of Str = 'Hello';

Course navigation

Quiz — Type constraints   |   Type conversion for typed variables


💪 Or jump directly to the exercises in this section.

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