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

Dependents:   Squirrel

Committer:
jhnwkmn
Date:
Tue Dec 16 10:20:34 2014 +0000
Revision:
0:97a4f8cc534c
Initial import of Squirrel.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhnwkmn 0:97a4f8cc534c 1 /*
jhnwkmn 0:97a4f8cc534c 2 *
jhnwkmn 0:97a4f8cc534c 3 * Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
jhnwkmn 0:97a4f8cc534c 4 *
jhnwkmn 0:97a4f8cc534c 5 */
jhnwkmn 0:97a4f8cc534c 6
jhnwkmn 0:97a4f8cc534c 7 function fib(n)
jhnwkmn 0:97a4f8cc534c 8 {
jhnwkmn 0:97a4f8cc534c 9 if (n < 2) return 1
jhnwkmn 0:97a4f8cc534c 10 return fib(n-2) + fib(n-1)
jhnwkmn 0:97a4f8cc534c 11 }
jhnwkmn 0:97a4f8cc534c 12
jhnwkmn 0:97a4f8cc534c 13 local n = vargv.len()!=0?vargv[0].tointeger():1
jhnwkmn 0:97a4f8cc534c 14
jhnwkmn 0:97a4f8cc534c 15 print(fib(n)+"\n")