$c+
module test11_6 { bounds check twoDimensions
-- test of array bounds check (2 dimension ) }
private
 integer i,j;
 constant max = 2;
 constant mlo = 1;
 typedefinition integer range [0..mlo] zero_mlo;
 integer array [zero_mlo][zero_mlo] a;
begin
 i := 0;
 do i <= max -> read a[i][0]; i := i+1; od; { data 1 2 3 }
 a[0][1] := a[0][0];
 i := 1;
 do i <= max -> 
	i := i+1;
	a[i][1] := a[i-1][1] + a[i][0] ; 
 od;
 i := 0;
 do i <= max -> 
	i := i+1;
	a[i][2]:= a[i][0] * a[i][1]; 
 od;
 i := 0;
 j := 0;
do i <= max & j <= max ->
	write a[i][j]; j := j+1;
	if j > max -> 
		i := i+1;
		j := 0;
	 [] j <= max -> skip;
	fi;
od;
 { output, if you don't catch the out of bounds
  error in the compiler then you get one
  run time error}
 end.
