mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00: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:
commit
d2b5b51b9c
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user