diff options
Diffstat (limited to 'test/fib.lua')
-rw-r--r-- | test/fib.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/fib.lua b/test/fib.lua new file mode 100644 index 00000000..881cbdc3 --- /dev/null +++ b/test/fib.lua @@ -0,0 +1,11 @@ +-- very inefficient fibonacci function + +function fib(n) + if n<2 then + return n + else + return fib(n-1)+fib(n-2) + end +end + +print(fib(20)) |