fibonacci.nut 256 B

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