Is it preferred to do:
if(a) {
if(b) {
//some statement(s)
}
} else if(c) {
//some statement(s) (the same ones as in the other block)
}
or
if((a && b) || (!a && c)) {
//some statement(s)
}
I currently have the first written. It feels easier to read and maintain, but duplicating the block feels like a smell to me. Is there a better third option that I'm missing?
!a && c
that would be obvious for its existence. – Cruncher yesterdayif (a ? b : c) { ... }
? – matts yesterday