Contents Previous Next Subchapters

Assigning Values To Constants
Syntax const constant = value
See Also assignment

Description
Assigns a value to the specified constant.

Tutorial
The constant directive sets a constant equal to a value. Once a constant is defined, it cannot be reassigned. The name used for the constant must not be previously defined.

For example, if you enter
     clear
     const I = 1i0
     print I
O-Matrix will respond
     (0,1)
If you then try to reassign I by entering
     I = 2i0
O-Matrix will respond with an error message.

Using With Functions
Constants defined outside of any function have global scope and are automatically visible with in all functions (see the discussion on constants in the Using Variables And Constants With Functions section).