Module: CoreEx::Numeric

Defined in:
lib/core_ex/numeric.rb

Instance Method Summary collapse

Instance Method Details

#factObject Also known as: _!



11
12
13
14
15
16
17
18
19
# File 'lib/core_ex/numeric.rb', line 11

def fact
  result = 1
  i = self
  until i.zero? do
    result *= i
    i -= 1
  end
  result
end