// -*- mode: java -*- // $Id: fibo.njs,v 1.1 2001/07/08 20:20:06 doug Exp $ // http://www.bagley.org/~doug/shootout/ // by David Hedbor <david@hedbor.org> // modified by Aldo Calpini <dada@perl.it> for Win32 function fib(n) { if (n < 2) return 1; return fib(n-2) + fib(n-1); } var n; ARGS = WScript.Arguments; if(ARGS.length > 0) { n = parseInt(ARGS.Item(0), "10"); if(n < 1) n = 1; } else { n = 1; } WScript.Echo(fib(n));