Hi --

On Fri, 25 May 2007, Chad Perrin wrote:

> On Fri, May 25, 2007 at 07:42:09AM +0900, dblack / wobblini.net wrote:
>>
>>   return v + 1 if its < 10
>
> I'm not really clear on how that's any better than this:
>
>  return v + 1 if v < 10
>
> In fact, I think the "its" version is a bit more ambiguous, and thus
> probably worse.  Am I missing something?

Yes: the its version is equivalent to:

   return v + 1 if v + 1 < 10

but doesn't require the v + 1 calculation to be performed twice.


David

-- 
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    (See what readers are saying!  http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)