Const Statement

Action

Declares a constant.

Syntax

[scope] const [data-type] const-name = expr [, const-name = expr]...
Variable Description
scope Optional: Either public (the default) or private. Private declaration are available only in the file in which they occur. Public declarations can be accessed from other files via a use statement. You can specify scope only if the declaration is global, which means that the declaration does not appear within a function, window, or winclass declaration.
data-type Optional: Any data type. If omitted, the constant has the same type as the type of expr.
const-name An identifier that names the constant being declared.
expr An expression that evaluates to the value you want to give the constant.

Notes

You use a constant to represent a fixed value. There are several types of constants. Some examples include:

  • Integer, such as 123 and 0xD7 (hexadecimal).

  • Floating-point, such as 123.45 and 4.39e-10.

  • Strings, such as "Now is the time".

  • Boolean (TRUE and FALSE).

Examples

[ ] const TEST_LEVEL = 1
[-] const LIST OF STRING lsTestName = {...}
	[ ] "TestA" 
	[ ] "TestX" 
[ ] const INTEGER iMaxName = 8, iMaxScript = 50
[ ] const BOOLEAN bDone = FALSE
[-] const LIST OF ANYTYPE laXYZ = {...}
	[ ] "foo" 
	[ ] 1
	[ ] TRUE
	[ ] 1.47
[ ] const REAL r = 1.234
[ ] const INTEGER iHex = 0x1A // Hexadecimal notation
[-] public const aiVersion[3] = {...}
	[ ] 1.0
	[ ] 1.5
	[ ] 2.0