I\'m trying to implement the following function, but it keeps giving me the stack level too deep (SystemStackError) error.
stack level too deep (SystemStackError)
Any ideas what the problem mi
It's been a while, but you can write a fairly elegant and simple one line function:
def fib(n) n > 1 ? fib(n-1) + fib(n-2) : n end