7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable Usage : Array Variables
 
Share this page                  
Array Variables
An array variable is referred to by the syntax:
arrayname[subscript{,subscript}] {[subscript{,subscript}]}
Syntax Notes:
1. The variable must be subscripted, because only scalar-valued elements (integers, floating-point and character strings) are legal EQUEL values.
2. When the array is declared, the array bounds specification is not parsed by the EQUEL preprocessor. Consequently, illegal bounds values will be accepted. Also, when an array is referenced, the subscript is not parsed, allowing illegal subscripts to be used. The preprocessor only confirms that an array subscript is used for an array variable. You must make sure that the subscript is legal and that the correct number of indices is used.
3. An array of characters is not a string unless it is packed or varying.
4. A packed or varying array of characters is considered a simple variable, not an array variable, in its usage. It therefore cannot be subscripted in order to reference a single character. For example, assuming the following variable declaration and subsequent assignment:
##  var
##      abc : packed array[1..3] of Char
    ...
    abc := 'abc';
you could not reference
abc[1]
to access the character "a". To perform such a task, you should declare the variable as a plain (not packed or varying) array, as, for example:
##  var
##      abc : array[1..3] of Char
    ...
    abc := ('a', 'b', 'c');