As for formatting only, I prefer:
if(MyFirstExtremlyLongExpressionWhichBarelyFitsIntoALine && MySecondExtremlyLongExpressionWhichBarelyFitsIntoALine && MyThirdExtremlyLongExpressionWhichBarelyFitsIntoALine ) {
But if the expressions are really long and full, you should define temporary variables to increase readability:
bool condition1 = MyFirstExtremlyLongExpressionWhichBarelyFitsIntoALine; bool condition2 = MySecondExtremlyLongExpressionWhichBarelyFitsIntoALine; bool condition3 = MyThirdExtremlyLongExpressionWhichBarelyFitsIntoALine; if(condition1 && condition2 && condition3) {
The latter also clarifies your intent if you execute more complex Boolean expressions:
if((!condition1 && !condition2) && condition3) {
source share