squirrel/samples/fibonacci.nut
Markus F.X.J. Oberhumer 0378c7016f Normalize whitespace.
Convert files to Unix EOL mode, de-tabify and strip trailing whitespace.
2016-02-15 20:51:20 +01:00

16 lines
240 B
Plaintext

/*
*
* 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 = vargv.len()!=0?vargv[0].tointeger():1
print(fib(n)+"\n")