Is it bad to explicitly compare against boolean constants?

Posted by polygenelubricants on Stack Overflow See other posts from Stack Overflow or by polygenelubricants
Published on 2010-04-18T04:15:03Z Indexed on 2010/04/18 4:23 UTC
Read the original article Hit count: 266

Is it bad to write:

if (b == false) //...

while (b != true) //...

Is it always better to instead write

if (!b) //...

while (!b) //...

Presumably there is no difference in performance (or is there?), but how do you weigh the explicitness, the conciseness, the clarity, the readability, etc between the two?

© Stack Overflow or respective owner

Related posts about java

Related posts about boolean