Skip to content

Instantly share code, notes, and snippets.

@tatey
Created January 31, 2010 12:46
Show Gist options
  • Save tatey/291048 to your computer and use it in GitHub Desktop.
Save tatey/291048 to your computer and use it in GitHub Desktop.
def fact(x)
x > 1 && x * fact(x - 1) || 1
end
puts fact(6)
f = lambda { |x| x > 1 && x * f.call(x - 1) || 1 }
puts f.call(6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment