by unwind · 9y ago · 0 comments
if (false != aBooleanVariable)
I still can't parse that without stopping and thinking (and sometimes cursing the original author). To me, with booleans, this can only sanely be written: if (aBooleanVariable)
Code with literals is often worse than functionally equivalent code without; literals are complexity. And I hate literal comparisons with true and false for booleans. Aargh. return (aBoolean != false) ? false : true;
So ridiculous that it made me laugh.if (aBooleanVariable) will return true for any truthy value, not just 'True'.
Of course I still prefer writing my if statements that way, it's just something you have to watch for if something does go wrong.