Sfairadora

  • Reference Guide

Array

Array is a compound type consisting of a fixed number of elements of the same type (the element type may be scalar or compound). Every element is identified by an integer index. The index of the first element is 0, the index of the second element is 1, and so on up to n–1 (where n is the number of the array elements).
The requirement of uniform element types can be circumvented by using union as the element type.
Every component may be marked as optional – in that case it need not be present in the instance.
In contrast to sequence, there is no operation for inserting or removing elements (an array element can be removed only when it is optional – however, in that case, elements with higher indexes do not move down, but they retain their indexes, and an “empty space” is preserved on the index of the removed element).
The array type corresponds to the mathematical concept of vector. For example, coordinates in a three-dimensional space can be defined by an array of real numbers with three elements.

Notation

Array(TYPE, N)
or
TYPE[N]
where TYPE is the type of the array element, and N is the number of the array elements.