Lessons
C++ · Repeating Things · 15. while Loops

step 1 of 6

Keep going while true

while (n > 0) means: check n > 0, and if it's true, run the body. Then check again.

n-- makes n smaller. Without it I would never stop!

Mission

Make the countdown start at 5.

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

while Loops