Xbasic

CONSTANT, SHARED, GLOBAL

Syntax

CONSTANT [SHARED|GLOBAL] Variable_Name = Value

Description

CONSTANT declares a constant variable. The constant variable's value is set when the constant is declared. The value may never be changed. While a constant variable cannot be changed, it can be deleted. See the examples below.

Example

'declares a local variable
CONSTANT tax_rate = .05

tax_rate = .06
ERROR: Attempt to assign to constant

? tax_rate
= 0.05

'declares a global constant variable
CONSTANT GLOBAL tax_rate = .05

'delete a constant variable
DELETE constant tax_rate

See Also