GLBasic User Manual

Main sections

CONSTANT

CONSTANT var = value



This command defines a global variable (var) with a value that can't be modified (value).

Attempting to change a variable value using another CONSTANT will not produce a compiler error, but the value won't be changed.

Trying to change the value without using will produce the following compiler error message :

error: assignment of read-only variable `__GLBASIC__::<var>'

CONSTANT A%=1
CONSTANT B%=A%

CONSTANT A%=3 // A% still equals 1

A%=4 // Compiler error

See also...