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
Use:
if (condition) { i = j = 1000; break; }