The while Loop in C++

🟢 Beginner Level | Pre-tested Conditional Execution

📖 Definition

The while loop in C++ evaluates a condition before every iteration. The loop body executes as long as the condition evaluates to true.

📝 Code Example

#include <iostream>

int main() {
    int count = 1;
    while (count <= 5) {
        std::cout << "Count: " << count << std::endl;
        count++;
    }
    return 0;
}