Files
grokking_algorithms/03_recursion/ruby/03_factorial.rb
2016-03-03 15:19:05 +01:00

10 lines
81 B
Ruby

def fact(x)
if x == 1
1
else
x * fact(x - 1)
end
end
puts fact(5)