in reply to Re^2: Avoiding the == blues
in thread Avoiding the == blues

Depends on the developer. It's better to write literal comparisons (literal the noun) as "bob".equals(someVariable), when there is a chance that someVariable could be null/nil/undef. Sorta the take on the if(someLiteral == someVariable) in c, so you couldn't write things like if(0=variable) by accident. Compiler err and all...

Replies are listed 'Best First'.
Re^4: Avoiding the == blues
by Baz (Friar) on Jan 01, 2005 at 20:25 UTC
    >>"Put the constant on the left," he repeated. "You can't assign to a constant, so it's a syntax error if you say = instead of ==." Interesting, but I have to say that with practice an alarm bell goes off when I write such conditional statement anyway. In the same way that an alarm bell woulld need to go off in order to remember to put the constant on the left.