From: "Jan E." Date: 2013-01-06T13:56:38+09:00 Subject: Re: Best practice for &&, ||, and, or Dave Aronson wrote in post #1091178: > No! No! 1000.times :no! ;-) > > Consider the difference between "x = true && false" and "x = true and > false". Since && has HIGHER precedence than =, "x = true && false" is > equivalent to "x = (true && false)", just as you might expect. Why would I expect that? Why would I even *use* assignments in "if" statements? Sorry, but if you use assignments in "if" statements (much too obscure) without explicit parenthesis (even worse), then I'd say *this* is your problem, not the implicit operator precedence you somehow consider to be "wrong". Maybe my programming style is totally out of fashion, but my "if" statements usually look like this: if and ( or ) ... end With being a pure expression (no change of state). In that context, I want a very low precedence to make sure that each is evaluated *before* and/or takes action. And I believe this is the sane way of writing "if" statements. When I want to do "magic" like var = val || alt then I do use &&/||. But this is a very different context. -- Posted via http://www.ruby-forum.com/.