7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable and Type Declarations : Variable Declarations
 
Share this page                  
Variable Declarations
An EQUEL/Pascal variable declaration has the following syntax:
var var_name {, var_name: type_definition [:= initial_value];
    {var_name {, var_name: type_definition [:= initial_value];}
Syntax Notes:
1. See the previous section for information on the type_definition.
2. The initial_value is not parsed by the preprocessor. Consequently, any initial value is accepted, even if it later causes a Pascal compiler error. Furthermore, the preprocessor accepts an initial value with any variable declaration, even where not allowed by the compiler. For example, both of the following initializations are accepted, even though only the first is legal in Pascal:
##  var
##      rowcount: Integer := 1;
##      msgbuf: packed array[1..100] of Char := 2;
The following is an example of a variable declaration:
##  var
##      rows, records:             0..500 := 0;
##      was_error:                 Boolean;
##      msgbuf:                    varying[100] of Char := ' ';
##      operators:                 array[1..6] of packed array[1..2] :=
##                 ('= ', '!=', '< ', '> ', '<=', '>=');
##      employees : array[1..100] of EmployeeRec; 
##      emp_ptr :                  ^EmployeeRec;
##      work_days :                (MON, TUE, WED, THU, FRI);
##      day_name :                 varying[8] of Char;
##      random_ints                file of Integer;
##      null_ind:                  Indicator;