From: Ben Giddings Date: 2007-10-20T11:27:50+09:00 Subject: Re: Is it always the norm to skip 'return'? On Oct 19, 2007, at 15:05, bbiker wrote: > The only time you need to implicitly use 'return' is when you want the > value of a variable that was processed prior to the last statement. > > for example: > > y = some_method(alpha, beta) > > do_some_cleanup before returning > > return y Actually, I'd say the only reason you should use return in a method is when you want to jump out of a method with a value and stop doing anything else, i.e. def foo(arg) arg.each do |e| if e.meets_some_condition? return e.text end end "Not found" end The advantage of only using "return" when you want to return prematurely is that it clues people into the fact that you're exiting prematurely. Otherwise you know that the method always returns the value of the last expression you evaluate. Ben