From: Robert Oliver Date: 2006-10-27T15:37:21+09:00 Subject: Re: simple math question ------=_Part_41943_10567544.1161931037605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/27/06, John Turner wrote: > > Not including a "return" statement makes it all a bit more "functional" > in my view. Basically, I'll leave off the return if the method is > really simple and it's obvious what the last statement is and that it's > being returned. If there's any complex control flow going on then it's > nicer to give the "reader"(potentially just yourself, but being nice to > your future self is good) the visual clue as to what's actually being > returned, even if it's still the last statement executed. I thought about leaving the return off, as self % 2 would return a 0 or 1, and 0 or 1 does not mean true or false. But then again, as someone pointed out previously, the method to check for zero is best there, and that does return true or nil. That was the best approach I suppose. Then again tho, the return statements will lead to more readability for programmers who don't know Ruby. -- Robert W. Oliver II President, OCS Solutions, Inc. - Web Hosting and Development http://www.ocssolutions.com/ Toll-Free Phone - 1-800-672-8415 OCS Ruby Forums - http://www.rubyforums.com/ My Blog - http://www.rwoliver.com/ ------=_Part_41943_10567544.1161931037605--