The goto-less goto!





0/5 (0 vote)
If the number of conditions is relatively small, the following code would made sense: bool bFailed = true; if (!condition1_fails) { if(!condition2_fails) { ... if(!conditionN_fails) { bFailed=false; ...
If the number of conditions is relatively small, the following code would made sense:
bool bFailed = true; if (!condition1_fails) { if(!condition2_fails) { ... if(!conditionN_fails) { bFailed=false; PerformActionOnAllSuccess(); DoNormalCleanup(); } } } if (bFailed) { DoFailedCleanup(); }