diff --git a/tests/programs/fib.alpha b/tests/programs/fib.alpha index bbc20f9..287614b 100644 --- a/tests/programs/fib.alpha +++ b/tests/programs/fib.alpha @@ -4,36 +4,20 @@ function entry : string2integer function fib : integer2integer fib(i) := { - [ integer: a; integer: b; integer: count ] - - a := 1; - b := 2; - if (i = 0) then { + if (i < 1) then { return 0; } else { - a := a; + i := i; } - if (i = 1) then { - return 1; + if (i < 2) then { + return i; } else { - a := a; + i := i; } - if (i = 2) then { - return 2; - } else { - a := a; - } - - count := 2; - while (count < i) { - - count := count + 1; - } - - return b; + return fib(i-1) + fib(i-2); } entry (arg) := {