Learning Labs / Logic & Boolean Playground
Turn conditions into understanding.
Build conditions, explore logic gates, and prove ideas with truth tables.
Lesson 01 / Build your understanding
Inputs, gates, and outputs
Identify which values are inputs and which value is produced by a gate.
01 / Concept
Start with the idea.
A Boolean condition has exactly two values: TRUE or FALSE. A letter such as A stands for a condition, not a number or a probability.
An input can represent a statement such as ‘the member is signed in’. A gate combines one or more inputs into an output. Our first example uses AND: the output is TRUE only when both inputs are TRUE.
Read the reasoning
The input toggles and output are separate. Changing A does not rewrite B; it asks the gate to evaluate the same rule with a new combination. A truth table lists every combination so you can check more than one example.
Key terms
- Input
- A truth value provided to an expression.
- Output
- The truth value produced by evaluating the expression.
- Truth table
- Every possible combination of input values and its result.
02 / Predict
What do you expect?
Boolean workbench
A–D / up to 16 combinationsRename input conditions
Follow the gate chain
Output: FALSEEach connected gate evaluates its inputs. The numbered trace below offers the same information without the diagram.
Why this gate returns FALSE
TRUE AND FALSE is FALSE. AND requires both inputs to be TRUE; at least one is FALSE.
A AND B with A=TRUE, B=FALSE.
Check every combination
2^2 = 4 rows| Load | A | B | Output |
|---|---|---|---|
| FALSE | FALSE | FALSE | |
| FALSE | TRUE | FALSE | |
| TRUE | FALSE | FALSE | |
| TRUE | TRUE | TRUE |
Build an equivalent condition
Scenario 1 / 2Confirm a booking. Confirm only when payment has arrived AND a seat is available.
- A
- Payment received
- B
- Seat available
Inspect the target truth table
| A | B | Target |
|---|---|---|
| FALSE | FALSE | FALSE |
| FALSE | TRUE | FALSE |
| TRUE | FALSE | FALSE |
| TRUE | TRUE | TRUE |
Expression rules & common mistakes
- Names are case-insensitive. Use only A, B, C, D, TRUE/FALSE (or 1/0) and the listed operators.
- NOT binds first, followed by AND, XOR, and OR. Parentheses override that order. The ^ alias here means Boolean XOR, not a JavaScript number operation.
- OR includes both true. Two-input XOR requires different values; chained XOR checks odd parity, not exactly one across many inputs.
- This model evaluates pure truth values. There are no numbers to coerce, function calls, or side effects; its trace is not JavaScript short-circuit execution.
- Expressions have at most 256 characters, 63 nodes, and 12 nested groups/NOTs. Four input variables keep every truth-table combination visible.
- A condition agreeing with another for the current toggles is not enough. Equivalence means agreeing for every row.
05 / Practice
Put the idea to work.
06 / Recap
Take the lesson with you.
- Inputs are independent truth values; gates produce an output.
- AND is true only when both inputs are true.
- Two independent inputs have four combinations, not just the current one.
Check your prediction and solve a practice challenge to complete this lesson.
References & further reading
Keep your curiosity going.
More Learning LabsLoading more Learning Labs…