From: Elliot Temple Date: 2006-07-13T16:21:07+09:00 Subject: Re: Recursion and Ruby On Jul 13, 2006, at 12:13 AM, Glenn Cadman wrote: > def fib ( n ) > if n == 0 > return 0 > elseif n == 1 > return 1 > else > return fib(n-1) + fib(n-2) > end > end You have a typo. it is elsif not elseif. elseif is just treated like a method call. it doesn't exist, but that error didn't come up because it was never reached. 0 gets returned first in that branch. otherwise it goes straight to the else clause. -- Elliot Temple http://www.curi.us/blog/