Created
June 27, 2011 05:46
-
-
Save chirantan/1048368 to your computer and use it in GitHub Desktop.
Factorial Program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum | |
def factorial | |
self > 1 ? (self * (self - 1).factorial) : 1 | |
end | |
end | |
puts 5.factorial |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment