The Squirrel interpreter. See http://www.squirrel-lang.org/

Dependents:   Squirrel

samples/fibonacci.nut

Committer:
jhnwkmn
Date:
2014-12-16
Revision:
3:7268a3ceaffc
Parent:
0:97a4f8cc534c

File content as of revision 3:7268a3ceaffc:

/*
*
* 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")