An array item may be of any type
Purpose:
Result list for a sporting event:
max_field : constant := 50;
type Number is range 1 .. 1000;
subtype String20 is String(1..20);
type Time is digits 7 range 0.0 .. 600.0;
type Competitor is record
id_number : Number;
name : String20;
club : String20;
run_time : Time;
end record;
type Result_list is array (1 .. max_field) of Competitor;
race1, race2 : Result_list;
Declarations
Referring to portions of the array:
race2 := race1;
race1 is an array of records, so
race1(J) is a record
Display_Competitor(race1(J));
race1(3).id_number := 23;
get (race1(I).id_number);
race1(J).name := "Joe Bloggs ";
PUT(race1(J).club);
GET(race1(next).run_time);
Two example programs show the design and code of programs that involve arrays of records: