prefix constant

Documentation for prefix constant assembled from the following types:

language documentation Variables

From Variables

(Variables) prefix constant

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.