Course of Raku / Advanced / Operators / Traits and pragmas 🆕 / Exercises

Relaxing strict

Problem

Raku’s strict pragma is on by default, so every variable must be declared with my before use. Turn it off with no strict and then, without any my, assign 10 to $a and 20 to $b, and print their sum.

Example

The program prints:

30

Solution

See the solution

Course navigation

Solution: A custom trait   |   Solution: Relaxing strict