Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 347 Bytes

break.md

File metadata and controls

23 lines (20 loc) · 347 Bytes

Break

break works the same with for loops as it does with while loops. Any time you hit a line with break you will immediately exit the loop.

~void main() {
for (int i = 0; i < 1000; i++) {
    if (i == 5) {
        break;
    }
    System.out.println(i);
}
System.out.println("Over");

// 0
// 1
// 2
// 3
// 4
// Over
~}