Key Concepts

Review core concepts you need to learn to master this subject

while Loop

while (password != 1234) { std::cout << "Try again: "; std::cin >> password; }

A while loop statement repeatedly executes the code block within as long as the condition is true. The moment the condition becomes false, the program will exit the loop.

Note that the while loop might not ever run. If the condition is false initially, the code block will be skipped.

Loops
Lesson 1 of 2

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo