Skip to content
LearnLoop
← Computer Science

Loops: do it again

See it

Don't repeat yourself

  • Computers are great at repeating.
  • A loop says: do this again, and again, until a condition stops it.
  • for (let i = 1; i <= 5; i++) means start at 1, stop after 5, add 1 each time.
Start
i = 1
Repeat
while i ≀ 5
Step
i++