Fundamentals14 / 25
Up next

break and continue

class Main {
    public static void main(String[] args) {
        for (int n = 0; n < 10; n++) {
            // skip this one
            if (n == 3) continue;
            // stop the loop
            if (n == 6) break;
            System.out.println(n);
        }
    }
}
What you're solving

exit early or skip an iteration