Scalar variables
So far, the programs we saw had hardcoded text strings. Let us introduce a bit of freedom and let the program use variables.
There are a few types of variables in Raku. A variable is a container that can keep some data in it. We’ll start with the simplest containers that can keep only a single value. Such containers are called scalars or scalar variables. A variable has a name prefixed with a special indicator that tells about the container’s nature. That indicator is a character called sigil. For scalar containers, such a sigil is a dollar character $
.
Here are a couple of examples of scalar variables:
$name
$age
Topics in this section
Exercises
This section contains 4 exercises. Examine all the topics of this section before going to the coding practice.
Course navigation
← Comments / Embedded comments | Declaring a variable →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська