Module: MathStatisticsArrayMethods::IntegerFactorial

Included in:
Integer
Defined in:
lib/math_statistics_array_methods/integer_factorial.rb

Overview

Will add the factorial method to the integers.

Instance Method Summary collapse

Instance Method Details

#factorialObject

Classic factorial.



11
12
13
14
15
16
17
# File 'lib/math_statistics_array_methods/integer_factorial.rb', line 11

def factorial
	f = 1
	for i in 1..self do
		f *= i
	end
	return f
end