Loops

Repeat work with clear exit conditions.

Do this: Read the concept below, then try the quiz or activity.

Lesson 6 of 20
25%

Concept

Loops (for/while) repeat a block until a condition changes. Avoid infinite loops by updating state or breaking out. Prefer for-each for collections when available.

Try it

Write a loop that sums numbers 1 through 100 and prints the total.