Course of Raku / Advanced / Containers

Special and dynamic variables 🆕

Raku variable names can carry a second marker after the sigil, called a twigil. The twigil tells you something about where the variable lives and how it is found — whether it is dynamically scoped, provided by the compiler, or tied to an object.

This section explains twigils, looks closely at the most useful kind — dynamic variables, which are looked up through the call stack rather than by ordinary lexical scope — and surveys the special variables that Raku predefines for you.

Topics in this section

Practice

Complete the quizzes that cover the contents of this section.

Exercises

This section contains 3 exercises. Examine all the topics of this section before doing the coding practice.

  1. A dynamic variable
  2. Override the dynamic
  3. The topic variable

Course navigation

Solution: Key and value   |   Twigils