Conditional logic
The practice of evaluating conditions and making decisions based on true/false results, forming the basis of selection constructs. Conditional logic enables programs to respond differently to different inputs and data states. Complex conditional statements combine multiple simple conditions using boolean operators. Conditional logic appears in selection statements, loops, and exception handling.
Real World
Uber's app uses conditional logic to check if a driver is within 5 minutes, the car type matches your request, AND the driver's rating is above 4.5 before assigning them to your ride.
Exam Focus
When writing conditions, use relational operators precisely — '>' vs '>=' is a common one-mark error in boundary cases.
How well did you know this?