Skip to content

Commit ae9204a

Browse files
Create test
1 parent ce03ee9 commit ae9204a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Java - How to Break out of Nested For Loops
2+
3+
class EscapeNestedLoops {
4+
public static void main(String[] args) {
5+
6+
for(int x=0; x<8; x++) {
7+
for(int y=1; y<4; y++) {
8+
System.out.println(x + " " + y + " " + x*y);
9+
if(x * y > 5)
10+
break;
11+
}
12+
}
13+
14+
System.out.println(" ");
15+
16+
xLoop:
17+
for(int x=0; x<8; x++) {
18+
for(int y=1; y<4; y++) {
19+
System.out.println(x + " " + y + " " + x*y);
20+
if(x * y > 5)
21+
break xLoop;
22+
}
23+
}
24+
25+
}
26+
}

0 commit comments

Comments
 (0)