Iteration

Why Loops Exist. Iteration means repeating a block of code. Instead of copying statements over and over, a loop runs the same code while a condition stays true. The simplest loop in Java is the while loop . How a while Loop Works. A while loop checks its boole

8 lessons, each with runnable code in the browser.

  1. The while Loop
  2. The for Loop
  3. Loop Boundaries and Off-by-One Errors
  4. Accumulation and Counting Patterns
  5. String Traversals with Loops
  6. Nested Loops
  7. Nested Loop Patterns and Dependent Bounds
  8. Informal Runtime Comparison

Compilearn home