Course of Raku / Essentials / Variables and data types essentials / Scalar variables

Declaration with initialization

If you know the value that you want to put in a variable at the time the variable is created, you can gain a line of code and write it in a single statement:

my $name = 'Anna';
say $name;

Multiple variables

To create and assign more than one variable, use the following pattern:

my ($name, $age) = 'Carl', 36;

Practice

Complete the quizzes that cover the contents of this topic.

Course navigation

Quiz 2: Assigning two values   |   Quiz 1: Declaration with initialization


💪 Or jump directly to the exercises in this section.

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