--
-- This is a test of unnamed loops and exit-when statements.
--
package test9 is body
    i, fib, oldfib, tmpfib : integer;
begin 
    fib := 1;
    oldfib := 1;
    write("This program also calculates the first 7 fibonacci numbers.");
    write("");
    write("fibonacci(1) = 1");
    write("fibonacci(2) = 1");
    i := 2;
    loop
	exit when i >= 7;
	i := i + 1; tmpfib := fib; fib := fib + oldfib; oldfib := tmpfib;
	write("fibonacci(", i, ") = ", fib);
    end loop;
end.
