Fibonacci numbers in Objeck

Example for versions Objeck 2.0.3

This example uses recursive definition of Fibonacci numbers.

bundle Default {
    class Fib {
        function :  Fibonacci (n: Int) ~ Int {
            if (n<=2) {
                return 1;
            };
            return Fibonacci(n-1) + Fibonacci(n-2);
        }
        function : Main(args : String[]) ~ Nil {
            for (i := 0; i <= 16; i += 1;) {
                Fibonacci(i)->Print();
                ", "->Print();
            };
            "..."->PrintLine();
        }
    }
}