1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 20:40:42 +02:00

Merge pull request #139 from amrnt/master

fix fib function for Lua: fib(0) must eql 0 not 1
This commit is contained in:
Adam Bard
2013-07-29 00:06:57 -07:00

View File

@@ -87,7 +87,7 @@ until num == 0
----------------------------------------------------
function fib(n)
if n < 2 then return 1 end
if n < 2 then return n end
return fib(n - 2) + fib(n - 1)
end