Semi-related: What do people think about if-else-if... chains vs nested simple if-else blocks? I have seen many cases on the job where someone writes a complex if-else-if chain and then an oversight in their logic WRT the dependencies between conditions causes the wrong branch to be taken. I prefer the latter style of the ones I've put below, especially when the conditions are more complex. For me, it makes it easier to mentally picture the control flow.
if(condition_a && condition_b){
do_thing_a();
} else if(condition_b){
do_thing_b();
} else {
do_something_else();
}
vs
if(condition_a){
if(condition_b){
do_thing_a();
} else {
do_thing_b();
}
} else {
do_something_else();
}
Furthermore, I prefer functional languages where if-then-else is an expression with a mandatory else (or doing control flow via pattern matching with enforced exhaustiveness like you can get with GHC). I don't like surprises.