Constants
Constants must be globally defined outside all other scopes by using a const
keyword. Constants can be set only to a constant expression.
const field PRIME = 31;
def main() -> field {
return PRIME;
}
The value of a constant can't be changed through reassignment, and it can't be redeclared.
Constants must be explicitly typed. One can reference other constants inside the expression, as long as the referenced constant is already defined.
const field ONE = 1;
const field TWO = ONE + ONE;
def main() -> field {
return TWO;
}
The naming convention for constants are similar to that of variables. All characters in a constant name are usually in uppercase.