Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ for else

// for else statement like python
for (int i = 0; i < foo; i++) {
     if ( breakCondition(i) )
         goto breakLabel; // use goto instead of break;
}
baz(); // only activate baz if for was not "broken"

breakLabel:
//...//
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
7+3 =