@c+
module test12_11 -- arrays and tuples together

private

typedef integer range [1..2]sub;
integer array[sub] x;
typedef [integer, integer] pair;
pair p;

pair array[sub] pa;

begin
x[1] := 2;
x[2] := 1;
x[1], x[2] := x[2], x[1];
write x[1];
write x[2]; -- 1, 2

p := [1,2*x[2]];
write p.1;
write p.2; -- 1, 4

pa[1] := p;
pa[2].2 := 3;
write pa[2].2;
write pa[1].2; -- 3, 4
end.
