I was trying to make a recursive algorithm with Ruby and I couldn't do it so I kept popping the stack as it were and each time I tried a simpler recursive algorithm to see where my mistake was..
But I arrived at this:
def fact(n)
if n==0
1
else
fact(n)*fact(n-1)
end
end
puts fact(5)
and
ruby/part2.rb:81: stack level too deep (SystemStackError)
Ok what is going on?
Is it not possible to make recursive algorithms in Ruby??