← Back to course
Code Crew G3 / Week 09 / Tuesday
2/6
Week 09 Β· Boolean Logic

Tuesday

// True, false, AND/OR

Tuesday: Truth Tables

Rocket builds a lamp with two switches. "It should glow only when both switches are on!" he says.

He flips the switches fast. Click, click, click. The lamp blinks on and off.

"Let's slow down," Raven says. "How many ways can two switches be set?" Nova glows softly. "Try writing each way on its own row," she says. Let's fill in the tables.

A TRUTH TABLE shows every combination. Fill in the answers (T or F).

ABA AND B
TT?
TF?
FT?
FF?
WHY THIS EXERCISEAND is how computers check multiple things at once: 'door is locked AND alarm is on.' Both have to be true to be safe.
ABA OR B
TT?
TF?
FT?
FF?
WHY THIS EXERCISEOR matches everyday choices: 'snack OR juice.' Either one (or both) makes you happy.
ANOT A
T?
F?
WHY THIS EXERCISENOT is the simplest operator. Programmers use it to invert a condition: 'IF NOT raining β†’ go to the park.'

Check Your Truth Tables

Use the rules. AND is TRUE only when both parts are TRUE. OR is TRUE when at least one part is TRUE.

ABA AND B
TT?
TF?
FT?
FF?
WHY THIS EXERCISEChecking every row is how programmers make sure a rule is right.
ABA OR B
TT?
TF?
FT?
FF?
WHY THIS EXERCISEAn OR table has only one FALSE row.

Now mix them. In A AND NOT B, first flip B. Then use AND.

ABA AND NOT B
TT?
TF?
FT?
FF?
WHY THIS EXERCISEBig rules are built from small ones, one step at a time.
TABLE FACTS
  • Read the question.
  • Tap your answer.
How many rows does a truth table with A and B need?
In an AND table, how many rows are TRUE?
In an OR table, how many rows are FALSE?
A is TRUE. What is NOT A?
A is FALSE. B is TRUE. What is A AND B?
Same values. What is A OR B?
Same values. What is NOT B?
Try it
Make two cards. One says TRUE and one says FALSE.
A grown-up says two facts joined by AND or OR.
Hold up the right card.
← Monday