summaryrefslogtreecommitdiff
path: root/src/3rdparty/squirrel/samples/fibonacci.nut
blob: 1db79423e59059c6c2a6250eeea8868984bb05e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
*
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
*
*/

function fib(n)
{
    if (n < 2) return 1
    return fib(n-2) + fib(n-1)
}

local n = ARGS.len()!=0?ARGS[0].tointeger():1

print(fib(n)+"\n")