Every condition in a program is either true or false. Logic words — AND, OR and NOT — combine conditions: AND needs both parts true, OR needs at least one, and NOT flips true to false.
What your child will learn
- Decide whether simple statements are true or false
- Use AND: both parts must be true
- Use OR: at least one part must be true
- Use NOT to reverse a condition
AND, OR, NOT
“The number is more than 2 AND less than 6” is true for 3, 4 and 5 only. “Less than 2 OR more than 6” is true for 0, 1, 7, 8 and up. A game might give a bonus only if score > 100 AND lives > 0 — miss either and there’s no bonus.
Example questions
Here are a few questions like the ones in the first quest. Can you solve them?
1. In coding, a condition is always either…
- big or small
- true or false
- red or blue
- up or down
Show answer
Answer: true or false. Conditions are checked as true or false.
2. “It is raining AND it is windy” is true when…
- only one part is true
- neither part is true
- always
- both parts are true
Show answer
Answer: both parts are true. AND needs both parts to be true.
3. What does NOT do to “true”?
- Makes it bigger
- Deletes it
- Keeps it true
- Turns it into false
Show answer
Answer: Turns it into false. NOT flips true to false, and false to true.
Tips for grown-ups
- Play “Stand up if you have a pet AND you like apples”, then try OR.
- Ask true-or-false questions at dinner: “Broccoli is blue OR carrots are orange.”