Curriculum

Curriculum

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.

Selected choicePick a choice below
Result—

Try it yourself

Predict the outcome of each pair of rule values.

Reveal the truth table
Rule ARule BANDOR
falsefalsefalsefalse
falsetruefalsetrue
truefalsefalsetrue
truetruetruetrue
Reveal the explanation
  1. Free room AND permission denied

    False. One required rule failed.

  2. No student card OR valid guest pass

    True. The guest pass satisfies one rule.

  3. 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.