-- -- This is a test of function semantics -- package test32 is body function factorial (b : integer): integer is function add (b, c : in integer): integer is begin return b+c; end; function times (b, c : in integer): integer is a, i : integer; begin i := 1; a := 0; loop a := add(a, c); exit when i == b; i := i+1; end loop; return a; end; begin if b <> 0 then return b*factorial(b-1); end if; return; -- should be some value; end; type complex is record r, i: float; end record; function makecomplex(r, i: float): complex is result: complex; begin result.r := r; result.i := i; return result; end; a : complex; begin a := makecomplex(1, 1); a := factorial(4); write ("factorial(4) = ", factorial(4), " (should be 24)"); end.