0PricingLogin
Dart Academy · Lesson

while and do-while Loops

Loop until a condition changes.

When Count Is Unknown

Sometimes you do not know how many passes you need ahead of time. A while loop repeats as long as a condition stays true. 🔄

The while Shape

A while loop checks its condition first, then runs the body. If the condition is false at the start, the body never runs at all.

while (condition) {
  // body
}

All lessons in this course

  1. The Classic for Loop
  2. while and do-while Loops
  3. for-in Over Collections
  4. break, continue, and Labels
← Back to Dart Academy