(* Simple Fibonacci sequence generator *)

Fibonacci ::
    (Object subclass)

    ivar a := 0,
    ivar b := 1,

    idef get_next
    {
        x := a + b;
        b := a;
        a := x;
    },
    ;


fib := Fibonacci create;
count := 40;


std.out
    << "The first ",
    << count,
    << " numbers in the Fibonacci sequence\n";


count times
{
    std.out << (fib get_next), cr;
};