diff options
| author | Lua Team <team@lua.org> | 1998-07-11 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 1998-07-11 12:00:00 +0000 |
| commit | 377347776f1f3d820f92151f70bec667f96d5e6b (patch) | |
| tree | cdb3ba26158df33547dfe765547177afcee119d1 /test/fib.lua | |
| parent | 4f8c5d0f284e1f4da717aea5008915f185cd2e05 (diff) | |
| download | lua-github-3.1.tar.gz | |
Lua 3.13.1
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)) |
