Course of Raku / Advanced / Operators
Traits and pragmas 🆕
Two features let you influence how code is compiled,
before it ever runs. A trait is a modifier attached to a
declaration — a variable or a routine — written with is. A
pragma is a module-like directive, switched on with
use (or off with no), that changes a rule for
the rest of the lexical scope.
You have already used a trait such as is default in
passing. This section looks at traits as a feature in their own right,
shows how to write your own, and introduces pragmas.
Topics in this section
Practice
Complete the 2 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.