If-Else Statements

If-Else = Making Choices

Run code only when a condition is true.

int orderTotal = 450;
if (orderTotal >= 500) {
    Console.WriteLine("Free delivery");
} else {
    Console.WriteLine("Delivery fee: โ‚น40");
}

One-Liner: Ternary

string result = score >= 40? "Pass" : "Fail";

Quick Check ๐Ÿง 

Easy Q1: What does age >= 18 check?

Comments on Conditional Statements (0)

No comments yet. Be the first to share your thoughts!