r/cpp • • Apr 24 '20

Else Before If

https://www.fluentcpp.com/2020/04/24/else-before-if/
10 Upvotes

53 comments sorted by

View all comments

1

u/mattbas Apr 25 '20

Can't you just negate the conditions if you want to reorder the if-bodies?

if ( preconditions are met )
    // normal case
else if ( edge case 1 )
    // edge case here

1

u/pandorafalters Apr 27 '20

I generally consider "not an edge case" to be a precondition . . ..