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