Setting the boolean first can setup a clearer if/else
if(!A && B) {
// set some boolean to false
}
if (A && B) {
// do something 1
} else {
// do something 2
}
Another strategy is to drop out of functions asap
e.g.
if(X) {
// do stuff
return;
}
if(Z)
{
// do different stuff
return;
}
// do default stuff
return;
This allows the reader to dismiss logic beyond the condition they are interested in
Finally you can also create functions with meaningful names rather than comments
if(X) {
return doSomething2();
}