From: Brian Candler Date: 2003-05-28T19:12:40+09:00 Subject: Re: Result of && and 'and' On Wed, May 28, 2003 at 05:14:56PM +0900, Robert Klemme wrote: > is it guranteed that && and "and" return the last value if all values > before that return true? Consider: > > irb(main):015:0> x=0 > 0 > irb(main):016:0> x>0 && x > false > irb(main):017:0> x=66 > 66 > irb(main):018:0> x>0 && x > 66 > > Not to be misunderstood: I like this, but I'm not sure whether this is > guaranteed by the language spec. I use it a lot in this form: a ||= "default" i.e. 'or' evaluates to the left-hand operand if it's not nil, otherwise it evaluates to the right-hand operand. So if it's not guaranteed, then changing it would break a lot of my code :-) Regards, Brian.