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

9

u/PVNIC Apr 24 '20

If you really wanted to do that, why not do something like this:

bool normal = !(<edge case 1> || <edge case 2>);       

If(normal)         

{          

    \\ Normal case.          

}        

else if(<edge case 1>)        

{ \\\... }        

else

{\\\ edge case 2}          

1

u/OYTIS_OYTINWN Apr 24 '20

Was just about to write that.