Algorithms

Iteration

Repeating a block of code while a condition holds, and stopping when it no longer does. It's done with loops like for and while.

Example

To add 1 to 100, a loop repeats "add the next one" 100 times and gives 5,050.

Test yourself: Iteration

Iteration and recursion

What is iteration?

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.