summaryrefslogtreecommitdiffhomepage
path: root/lua.html.markdown
diff options
context:
space:
mode:
authorAmr Tamimi <amrnt0@gmail.com>2013-07-28 21:34:27 +0300
committerAmr Tamimi <amrnt0@gmail.com>2013-07-28 21:34:27 +0300
commit7938abfe88aa985320776bbd9a428a581dadc621 (patch)
treeea0fe31a815a6154607e6668e690774cccb38f7f /lua.html.markdown
parenta7fe2983ccbe5de97d5f21ee1ee0e2aac1e0be16 (diff)
fix fib function for Lua: fib(0) must eql 0 not 1
Diffstat (limited to 'lua.html.markdown')
-rw-r--r--lua.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua.html.markdown b/lua.html.markdown
index 0ece399f..7325a1cf 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -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