Breaking out of nested loops in C++ -



Breaking out of nested loops in C++ -

this question has reply here:

can utilize break exit multiple nested loops? 14 answers

say have next code , when break want break out of inner , outer loop instead of inner loop , go straight blablabla. how can in c++?

for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... break; // breaks out of inner loop } } } blablabla ...

"go straight [...]" sound perfect job goto. , !

for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... goto afterloop; // breaks out of both loops } } } afterloop: // more stuff

c++ for-loop

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -