On 6/20/05, Nikolai Weibull <mailing-lists.ruby-talk / rawuncut.elitemail.org> wrote: > Jason Foreman wrote: > > > Even though it turns out there is no performance benefit to 1 == x > > over x == 1, I find it desirable to write the former anyway. If you > > accidentally write x = 1 instead of x == 1, it can take a long time to > > figure out your bug. But if you write 1 = x instead of 1 == x, you > > get a syntax error, and can immediately correct the mistake. > > % ruby > if x = 1; end > -:1: warning: found = in conditional, should be == > > So please don't write your code as if it was 1980 and you were using a C > compiler, > nikolai Amen. Even C compilers catch this sort of thing now; there's no need for this logic-bending construct anymore.