constant
ErrorsCollection

constant

Synthesised documentation from language/variables

From language/variables

See Original text in context

The constant prefix declares that the value it tags is not going to change during its lifetime.

constant $pi2 = pi * 2;
$pi2 = 6# OUTPUT: «(exit code 1) Cannot assign to an immutable value␤ 

The value is assigned at compile time. Since Raku modules are precompiled automatically, constants defined in modules are not re-evaluated when the program is run. Please check the section on constants in the Terms page for additional information.