raz / test / mac / Loop.raz

27 lines · 487 B · raw · history · last change 2b92b442

1(* Variables, a loop, calls with arguments and a narrow integer: the
2 status is the sum of 1 to 10, 55, plus 200 cut to a U8, 255 *)
3module Loop;
4
5var total: INT;
6
7proc add(var t: INT; n: INT);
8begin
9 t := t + n;
10end;
11
12proc main*: INT;
13var i, sum: INT; b: U8;
14begin
15 i := 1;
16 while i <= 10 do
17 add(sum, i);
18 INC(i);
19 end;
20 total := sum;
21 b := 200;
22 b := b + 200;
23 if total = 55 then return total + INT(b) - 144; end;
24 return 1;
25end;
26
27end Loop.