Variables Description

Syntax

$ VariableDeclaration = VAR VarSection { VarSection }

$ VarSection = ( IdentList ":" ClassType | ident ":" ClassType { "=" ConstExpression } ) ";"

$ IdentList = ident {"," ident}

$ ClassType = qualident

Description

Variables description is used to define cells in the memory and to match them to identifiers and the specified types.

All the variables, the identifiers of which are listed in one list, are variables of the same type. A class, interface or enumerable type can be specified as a variable type.

When describing a variable, it can be assigned with an initial value.

Example

Sub VarSample;

Var

// Simple variable declaration

v1: Integer;

v2: Double;

v3: Char;

v4: String;

v5: Boolean;

// Variable declaration with assigning values to them

v6: Integer = 10;

v7: Double = 6.66;

v8: Char = 'A';

v9: String = "S1S2";

v10: Boolean = True;

Begin

v1 := 10;

v2 := 6.66;

v3 := 'A';

V9 := "S1S2S3";

End Sub VarSample;

See also:

Data Types|Descriptions and Syntax Rules