Lesson 9 of 50
cLoops – while & do / while
8 mins
Course progress18%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 9 of 50
c8 mins
Keep these ideas in mind as you work through the lesson.
Loops repeat a block of code while a condition holds.
while(condition) { … } – condition checked before each iteration.do { … } while(condition); – body executes at least once before the condition check.Both can create infinite loops if the condition never becomes false.