+ 1
Break All???
How can i break from multiple nested for loops??
2 Antworten
+ 5
outer:
for (int a : array) {
for (int j : array2) {
if (i == j) break outer;
}
}
Create a label before a loop and use this label in break.
+ 2
You can for example use booleans:
loop1
loop2
loop3
if bla bla
vartostop = true;
if vartostop == true { break; }
if vartostop == true{break}
if vartostop == true {break}