for Loop

noun

say it: “FOR loop” /ˈfɔr lup/

A loop that repeats code a set number of times, with its start, its stopping condition and its step all on one line.

What is for Loop in Java?

for Loop — A loop that keeps its setup, condition, and update together.

class Schedule {
    void markThreeDays(boolean[] scheduled) {
        for (int day = 0; day < 3; day++) {
            scheduled[day] = true;
        }
    }
}

In a sentence

  • “I used a for loop that counts from 1 to 10 to print the times table for 7.”

Level: Apprentice · More Java terms at this level

Updated

In other subjects