Module: Math

Defined in:
lib/math/math.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.factorial(n) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/math/math.rb', line 2

def self.factorial(n)
  if n == 0
    1
  else
    n * factorial(n - 1)
  end
end