After any parameter declarations, an open square bracket begins any variable and/or module declarations. For variables, each declaration consists of a variable name that must be unique within the module, and ends with a semicolon. Variables may be made constant, shared or persistent simply by preceding them by these reserved keywords. Simple variables may be declared with a default value by placing an assignment operator (=) and a constant after the declaration. For example:
[
x = 4 { Default value of 4 };
]
Array variables are declared by specifying the number of elements in square brackets following the name. An optional feature is to specify the starting subscript for an array by placing an additional value in front of the number of elements. Arrays may be shared or persistent as well by prefixing the appropriate reserved word.
[
tempReadings[100] { Temperature readings from each station };
Shared stnIDs[2,5] { Station identifiers };
]
Modules are declared by specifying their name followed by the reserved word Module. Queued modules are preceded by the reserved word Queued. Modules may not be declared as persistent, shared or arrays.
[
GridSet Module { Opens a dialog box that sets grid attributes };
]
Note: If a module or variable is declared with the same name as a built-in function, such as Caller, the new declared member overrides the built-in function. This allows you to redefine any built-in functions you like; however, the function you are replacing will no longer be available within the scope of the new declaration (for example, in the same module where the declaration occurs – see Scope).
Any variable may have its class set in its definition by specifying the class in parentheses as the last item before the semi-colon. For example:
myVar = 26 (2);
x (5);
The first statement gives myVar a default value of 26 and sets its class to 2; the second statement does not assign a default value to x but sets its class to 5.
After all variables and modules have been declared, the block is completed with a closing square bracket.