Please enable JavaScript to use CodeHS

Chapter 4


4.2 for Loops

Breaking Down the for Loop

Putting It All Together

for Loop


Count By Twos

Off By One Errors

For Loop Sum

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Replace while Loop with for Loop


Term Definition
Off by One Error When a for loop iteration is off by one too many or one too few.