On Fri, 9 Dec 2005, Christer Nilsson wrote:
> Hmm, why are these two assertions breaking?

>    assert_equal false, true && false
>    assert_equal false, true and false # breaks

'&&' and 'and' have a different level of precedence, as such, the two 
statements are read as:

      assert_equal (false, true && false)
      assert_equal (false, true) and false


Similar for the 'or'. In the case of the or, you could even observe this 
in irb:

 	irb(main):004:0> puts false || true
 	true
 	=> nil
 	irb(main):005:0> puts false or true
 	false
 	=> true


Since the 'or' has a lower precedence than the '||', the 'or' is applied 
to the result of puts, not to the parameter 'false'.




Benedikt


   ALLIANCE, n.  In international politics, the union of two thieves who
     have their hands so deeply inserted in each other's pockets that
     they cannot separately plunder a third.
 			(Ambrose Bierce, The Devil's Dictionary)