May 23, 2024
Multiple AND conditions: Use when all conditions must be true.
MinScore = 75
.Score1 ≥ 75 AND Score2 ≥ 75 AND Score3 ≥ 75
.Multiple OR conditions: Use when any one condition must be true.
MinScore = 75
.Score1 ≥ 75 OR Score2 ≥ 75 OR Score3 ≥ 75
.AND takes precedence over OR: In mixed expressions, AND conditions are evaluated first.
Age ≥ 65 AND Rating = 'G'
is evaluated before Age ≤ 12
.Using Parentheses for Clarity:
(Age > 12 AND Age < 19) OR ValidID = 'Yes'
.Pet = 'Dog' AND Age > 10 OR Age < 5
.Pet = 'Dog' AND (Age > 10 OR Age < 5)
.Nesting IF Statements: Preferred to avoid logic complexity.
Rating = 'G'
:
Age ≤ 12
or Age ≥ 65
, apply discount.Confidence with OR: If confident, use the OR operator in the first decision.
Age ≤ 12 OR Age ≥ 65
.That concludes the section on making decisions. Next topic: Loops.