// Test of arrays and records
//
// $Id: test5.mgl,v 1.3 2004/11/29 11:17:21 gkminix Exp $

program test5;

type
  myindex = 10..20;
  myrec = record
            i : integer;
            s : string[10];
            c : char;
          end;
  myarray = array [myindex] of integer;

var
  r1, r2 : myrec;
  a1, a2 : myarray;
  ind : myindex;
  i : integer;
  c : char;
  s : string;

begin

// Assignments
  r1.i := 10;
  r1.s := "teststring";
  r1.c := 'A';
  r2 := r1;
  i  := r2.i;
  c  := r2.c;
  s  := r2.s;
  a1[10] := 1;
  a1[11] := 2;
  a2 := a1;
  i  := a2[10];
  i  := a2[11];

// Variable array index
  ind := 10;
  while (ind < 20) do
    begin
      a2[ind] := ord(ind);
      ind := succ(ind)
    end;
  a2[ind] := ord(ind);
  ind := 10;
  i := 0;
  while (ind < 20) do
    begin
      i := i + a2[ind];
      ind := succ(ind)
    end;
  i := i + a2[ind]
end.

