Boolean Operations Flashcards
All 6 cards in this deck
Name the three common Boolean operators.
AND, OR and NOT.
When is a condition joined by AND true?
Only when both conditions are true.
When is a condition joined by OR true?
When at least one of the conditions is true.
What does the Boolean operator NOT do?
e.g.
NOT (age > 18)Reverses the result of a condition.
NOT (age > 18)is true when age is 18 or less.How do you write a selection statement that runs only when two conditions are both met?
e.g. age is at least 13 and member is True
Join the two conditions with AND:
IF age ≥ 13 AND member = True THEN
…ENDIFIn what order are the Boolean operators evaluated in a condition?
Brackets first, then NOT, then AND, then OR.