From: Elliot Temple Date: 2006-08-26T04:51:27+09:00 Subject: Re: and and or priority On Aug 25, 2006, at 12:38 PM, Alex Young wrote: > Pavel Smerk wrote: >> OMG! >> Why the and and or operators have the same priority? Unlike && and >> || and also unlike the most of, or maybe all, other languages and >> conventions? > Good question. > > irb(main):001:0> true and false or true and false > => false > > tells me that and binds tighter than or, unless something unobvious > is going on, which might well be... > > Have you got a counterexample handy? irb(main):008:0> true or true and false => false If "and" had higher priority, that'd evaluate as: true or true and false true or false true I think it's going left to right: true or true and false true and false false Pickaxe page 339 says they have the same priority and calls them "logical composition" operators. As to the OP's question: I don't know why. -- Elliot Temple http://www.curi.us/blog/