Files
monkey/examples/fibi.monkey
Chuck Smith ca4eed10b8
Some checks failed
Build / build (push) Failing after 1m26s
Test / build (push) Failing after 11m43s
More tests
2024-03-18 19:46:54 -04:00

18 lines
214 B
Plaintext

let fib = fn(n) {
if (n < 3) {
return 1
}
let a = 1
let b = 1
let c = 0
let i = 0
while (i < n - 2) {
c = a + b
b = a
a = c
i = i + 1
}
return a
}
print(fib(35))