Node:Array Types, Next:, Previous:Subrange Types, Up:Type Definition Possibilities



Array Types

type
  array_type_identifier = array [index_type] of element_type
or
type
  array_type_identifier = array [index_type, ..., index_type] of element_type

The reserved word array defines an array type. index_type has to be an ordinal type, subrange type or an enumerated type, where several index types, separated by commas, are allowed. element_type is an arbitrary type. An element of an array is accessed by array_type_variable [index_number]. The upper and lower index bounds can be determined by the intrinsic functions High and Low.

type
  IntArray = array [1 .. 20] of Integer;
  Foo      = array [(Mo, Tu, We, Th, Fr, Sa, Su)] of Char;
  Bar      = array [0 .. 9, 'a' .. 'z', (Qux, Glork1, Fred)] of Real;
  Baz1     = array [1 .. 10] of IntArray;
  { equal (but declared differently): }
  Baz2     = array [1 .. 10, 1 .. 20] of Integer;

See also

High, Low