Combine Two Rules with AND and OR
Scenario
A student card or guest pass can grant entry. A room booking requires a free room and permission to book.
Try it yourself
Predict the outcome of each pair of rule values.
| Case | Result |
|---|---|
| Free room AND permission denied | Select a choice above to see what happens. |
| No student card OR valid guest pass | Select a choice above to see what happens. |
| No student card OR no valid guest pass | Select a choice above to see what happens. |
Reveal the truth table
| Rule A | Rule B | AND | OR |
|---|---|---|---|
false | false | false | false |
false | true | false | true |
true | false | false | true |
true | true | true | true |
Reveal the explanation
- Free room AND permission denied
False. One required rule failed.
- No student card OR valid guest pass
True. The guest pass satisfies one rule.
- No student card OR no valid guest pass
False. Neither rule is true.
List the four combinations of true and false for two rules. Check what AND and OR return for each.
Download shared test cases
Your turn
Draw the four possible pairs of boolean inputs and evaluate AND and OR for each.
Common mistake Assuming OR fails when both inputs are true.
Check your work
A four-row truth table. The row with two true inputs returns true for both operators.
This browser could not save your progress. Changes last until you leave the page.