Skip to content

Instantly share code, notes, and snippets.

@92thunder
Created May 27, 2014 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 92thunder/c1a1b3e62df1d22fd189 to your computer and use it in GitHub Desktop.
Save 92thunder/c1a1b3e62df1d22fd189 to your computer and use it in GitHub Desktop.
Node.js vs Ruby (Fibonacci number)
var sys = require('sys');
function fib(n) {
if (n < 2) return n;
return fib(n-2) + fib(n-1);
}
sys.print(fib(39));
def fib n
return n if n < 2
fib(n-2) + fib(n-1)
end
print fib(39)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment