If I use a break statement, it will only break inner loop and I need to use some flag to break the outer loop. But if there are many nested loops, the code will
break
int i = 0, j= 0; for(i;i< 1000; i++){ for(j; j< 1000; j++){ if(condition){ i = j = 1001; break; } } }
Will break both the loops.