The if Decision Statement

🟢 Beginner

📖 Definition

The single-branch if statement evaluates a boolean expression. If true, the code block inside { ... } is executed; otherwise it is skipped.

💡 Code Example

#include <iostream>

int main() {
    int age = 20;
    if (age >= 18) {
        std::cout << "Eligible to vote!\n";
    }
    return 0;
}