Is this the best forum to ask beginner questions? I’m learning Ruby
and I need a support community.
I’m work on the factorial method on page 84 of Pine’s book. Here’s
def factorial num
if num < 0
return ‘You can’t take the factorial of a negative number!’
if num <= 1
num * factorial(num-1)
My question is, why wouldn’t num go below 1 (like 0 or negative
integers) and result in a return of the string ‘You can’t take the…’?
Is something built into Ruby to stop at 0?