11 lines
193 B
Text
11 lines
193 B
Text
F fib(n:Int) {
|
|
n < 2 returns n
|
|
local a = 1, b = 1
|
|
# i is automatically local because of for()
|
|
for(i=2; i<n; i=i+1) {
|
|
local next = a + b
|
|
a = b
|
|
b = next
|
|
}
|
|
b
|
|
}
|