I have always written my boolean expressions like this:
if (!isValid) {
// code
}
But my new employer insists on the following style:
I just want to say I learned C twenty years ago in school and have moving onto Perl and Java and now C# which all have the same syntax and...
I think (!myvar) is the most popular
I think (myvar==false) is just fine too
in 20 years i have NEVER EVEN SEEN
(false==myvar)
I think your boss is smoking something-- I'm sorry but I'd take this as a sign your boss is some kind of control freak or numbskull.
IMO the first one is much more readable while the second one more verbose.
I would surely go for the 1st one
It was discussed for C# several hours ago.
The false == isValid
construct is a leftover from C-world, where compiler would allow you to do assignments in if
statement. I believe Java compilers will warn you in such case.
Overall, second option is too verbose.