Icon Variable Declarations

Variable declarations must be in the following format:

<Variable Declaration>;
[<Variable Declaration>;]

<Variable Declaration> =

   <Variable Name> [,<Variable Name>]: <Type Name> = <Default Expression>

The <Variable Name> and <Type Name> elements must follow the rules for identifiers covered in the Introduction topic, and each variable declaration must be terminated with a semicolon statement terminator (;).

The <Default Expression> element can be any valid expression that does not contain any variable, function, or procedure references. In other words, the expression can only contain other constant references, or literal expressions. Examples of literal expressions can also be found in the Introduction topic. The <Default Expression> element is used to initialize the variable to a specific value. This is useful in ensuring that a variable is not in an uninitialized state when it is referenced in code.

Warning If you don't set a default expression for a variable declaration and do not assign a value to the variable, then the value of the variable is undetermined. You should always make sure that such global variable declarations are initialized properly through a default expression or assignment. This does not, however, apply to variables declared within a class. Please see the Variables topic for more information on declaring variables in a class.