module Gemmy::Patches::IntegerPatch::InstanceMethods::Factorial

Public Instance Methods

factorial() click to toggle source

facets

# 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