20 lines
193 B
Ruby
20 lines
193 B
Ruby
|
# factorializer!
|
||
|
|
||
|
def fact(n)
|
||
|
if n == 0
|
||
|
return 1
|
||
|
else
|
||
|
return n * fact(n - 1)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
def main()
|
||
|
puts fact(ARGV[0].to_i)
|
||
|
end
|
||
|
|
||
|
|
||
|
if __FILE__ == $0
|
||
|
main()
|
||
|
end
|