James Edward Gray II wrote:
> On Jun 5, 2007, at 8:37 PM, Stephen Smith wrote:
> 
>> Is there a short circuit AND in ruby?
> 
> && does short-circuit.

as does "and", but beware the lower precedence:


irb(main):010:0> x = false && 3; x
=> false
irb(main):011:0> x = true && 3; x
=> 3
irb(main):012:0> x = false and 3; x
=> false
irb(main):013:0> x = true and 3; x
=> true
irb(main):014:0> x = (false and 3); x
=> false
irb(main):015:0> x = (true and 3); x
=> 3


-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407