Module: Gemmy::Patches::IntegerPatch::InstanceMethods::Factorial
- Defined in:
- lib/gemmy/patches/integer_patch.rb
Instance Method Summary collapse
-
#factorial ⇒ Object
facets.
Instance Method Details
#factorial ⇒ Object
facets
69 70 71 72 73 74 |
# File 'lib/gemmy/patches/integer_patch.rb', line 69 def factorial return 1 if zero? f = 1 2.upto(self) { |n| f *= n } f end |