Variables

Variable is a code element, which value can change during unit execution. A variable type is set at declaration, in the future the variable may take values only with the specified type of compatible type.

Variables are entered into a program to store and pass data inside the program. All variables used in a program must be first of all defined in the variable description section. A variable description section starts with the Var keyword followed by the definitions of variables.

Define a variable name (identifier) and type to describe a variable. A class, interface or enumerable type can be specified as a variable type. A colon is used to separate a name and type. A semicolon is used to end the variable declaration and description. Variables of one type may be listed via a comma before their type definition. The beginning of any other unit block or procedure or function description section means the end of the description block.

A variable may store a specific value or a reference to a value. A variable exists while the block, in which it is defined, is executed:

Var
    <identifier>: <type>;

Example

Var
    a, b: Integer;
    Sum: Double;
    Mb: IMetabase;

See also:

Fore Language Guide | Constants