For Loop

A basic for loop keeps its setup, continuation test, and update together in one header.

It is a good choice for counting across a known range. The loop variable often exists only inside the loop, keeping its scope narrow.

Count through a range

public class Main {
    public static void main(String[] args) {
        int count = 3;
        for (int review = 1; review <= count; review++) {
            System.out.println("Review " + review);
        }
    }
}

Output:

Review 1
Review 2
Review 3

review starts at 1 and continues through count. After every body execution, review++ adds 1 to it.

Choose < or <= deliberately. The difference determines whether the upper boundary is excluded or included.

Complete the loop so it prints lap numbers 1 through the supplied total.