Course of Raku / Essentials / Variables and data types essentials / Scalar variables
Declaring a variable
Variables must be announced before you use them. Raku has special
declarators for this. To declare a variable, use
my as shown below:
my $name;Having said that, you introduced a new variable, which keeps no payload so far. But it is already known to the compiler to identify it when it sees the same name later in the program.
More than one variable
You can declare two or more variables using the same my
declarator:
my ($x, $y);Practice
Complete the quizzes that cover the contents of this topic.
Course navigation
← Scalar variables | Quiz 1: Declaring a variable →
💪 Or jump directly to the exercises in this
section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська