pocketlang/test/examples/fib.pk
2021-05-27 15:38:33 +05:30

18 lines
200 B
Plaintext

## Fib test.
res = ''
def fib(n)
a = 0; b = 1
for _ in 0..n
res += to_string(a) + " "
temp = a;
a = b;
b += temp;
end
end
fib(10)
print(res)
assert(res == '0 1 1 2 3 5 8 13 21 34 ')