Boolean Code Clarity - which style to use? [closed]
- by Anonymous
I was wondering what style others' use when writing conditional statements that include boolean types. Currently I'm caught between using two styles.
bool foo;
if (foo == true)
if (foo)
if (foo == false)
if (!foo)
Obviously the first set is a bit more obvious. However, when combining conditions it could get a bit clunky.
if (foo == true || blah == false || abc == true)
if (foo || !blah || abc)
Switching between one style for short conditionals and the other for long conditionals seems like inconsistent coding so it seems like I'd have to choose between one or the other. What do you prefer or consider better style and why?