# Typecheck and code generation, records with array elements
var a : record of {n : array of int, m : array of bool  };
var i : int, total : int;

allocate a;
allocate a.n of length 5;
allocate a.m of length 5;

i = 0;
while ( i < 5) do 
{
    a.n[i] = i;
    a.m[i] = false;
    i = i + 1;
} 

i = 0;
total = 0;
while ( i < 5) do 
{
    total = total + a.n[i];
    i = i + 1;
} 

write total;

