@Const

Specifies that a procedure can (and must) calculate a result at compile-time.

Instructions

You can use the modifier @Const with some procedures. Typically, you use it with methods of a module of the type Library. But, you can also use it with procedures of the type Sub.

Note: Although you cannot use @Const with procedures of the type Function, such procedures can operate almost the same.

You call a procedure with @Const with the statement Const. Const makes a named constant, which has a value that you cannot change after it is set. The expression after the operator = must be a constant expression. A constant expression calculates a result only from values known at compile-time.

Rules

Data types
The procedure must return a value of an elementary data type. Also, the procedure can have parameters only of an elementary data type. Typically, these data types have values that you can write as a literal.
Mixed modifiers
You cannot use @Const with @Abstract or @Open because which procedure to call is not known at compile-time.
You cannot use @Const with @Iterator because an iterator procedure wraps its return type in an object.
You can use @Const with @MustUse. But, @Const has the same effect as @MustUse to cause you to use the return value.

Applicable to

Examples

TODO

See also