For Loop Basics
Understand for loop syntax, count up and down, accumulate totals, and use break/continue.
For Concept
For loop repeats code with three parts in one line: init; condition; update.
for (int i = 0; i < 3; i = i + 1) {
System.out.println("Loop " + i);
}
Count Up
Count up 1..5.
for (int i = 1; i <= 5; i = i + 1) {
System.out.println(i);
}
All lessons in this course
- For Loop Basics
- Nested For & Text Patterns
- Pattern Practice & Mini-Challenges