C# Nested IFs OR and condition?

The first one would have to look at the value of process_checking twice, so performance would be (very very negligibly) worse. And of course your assumption about the “0” and “1”, the first one has to check for “1”, which is a little extra work.

The real difference is readability. The second one is much more readable – it’s very clear what you’re doing, and that if process_checking is not true, the entire block gets skipped.

As long as you’re not nesting too deep, a little bit of nesting is definitely preferred when it adds to readability.

Leave a Comment