Next: , Previous: Arg, Up: Reference



array

Synopsis

In type definitions:

     array [index_type] of element_type

or

     array [index_type, ..., index_type] of element_type

In parameter list declarations:

     array of element_type

Description

The reserved word array is used to define an array type.

@@conformant/open arrays

Conforming to

Array types are defined in ISO 7185 Pascal.

Example

     program ArrayDemo;
     type
       IntArray = array [1 .. 20] of Integer;
       WeekDayChars = array [(Mon, Tue, Wed, Thu, Fri, Sat, Sun)] of Char;
       Foo = array [0 .. 9, 'a' .. 'z', (Baz, Glork1, Fred)] of Real;
       TwoDimIntArray = array [1 .. 10] of IntArray;
       { is equivalent to: }
       TwoDimIntArray2 = array [1 .. 10, 1 .. 20] of Integer;
     
     procedure PrintChars (F: array of Char);
     var
       i: Integer;
     begin
       for i := Low (F) to High (F) do
         WriteLn (F[i])
     end;
     
     var
       Waldo: WeekDayChars;
     
     begin
       Waldo := 'HiWorld';
       PrintChars (Waldo)
     end.

See also

Keywords, Array Types, High, Low