Guided Notes
Conditions: if, else & switch
Branching with if, else if, and else; nesting; the ternary operator; switch with break and default; and writing clear conditions.
if, else if, else
Slide 1 / 5if (score >= 90) { printf("A\n"); } else if (score >= 80) { printf("B\n"); } else { printf("C or below\n"); }
The first true condition wins, so order checks from most to least specific. Always use braces — without them only the next statement is inside the if, a famous source of bugs (Apple's "goto fail" security flaw).
