The if-else Decision Statement

🟢 Beginner

📖 Definition

The two-branch if-else statement executes the if block when the condition is true, or the else block when the condition is false.

💡 Code Example

#include <iostream>

int main() {
    int score = 45;
    if (score >= 50) {
        std::cout << "Passed!\n";
    } else {
        std::cout << "Failed.\n";
    }
    return 0;
}