8 lines
132 B
Text
8 lines
132 B
Text
|
|
def factorial(n)
|
||
|
|
result = 1
|
||
|
|
for i in range(1, n)
|
||
|
|
result = result * i
|
||
|
|
end
|
||
|
|
return result
|
||
|
|
end
|