Skip to lesson

Learning Labs / Logic & Boolean Playground

Turn conditions into understanding.

Build conditions, explore logic gates, and prove ideas with truth tables.

Learning path / 7 lessons0 / 7 completed

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?

A is TRUE and B is FALSE. What does A AND B produce?
03 / Experiment → 04 / ExplainChange one thing. See why.

Boolean workbench

A–D / up to 16 combinations
Binding orderNOT → AND → XOR → ORParentheses evaluate first.
Use A–D, TRUE/FALSE, NOT/AND/OR/XOR, and parentheses. !, &&, ||, ^ are aliases.
Rename input conditions

Follow the gate chain

Output: FALSE

Each 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
A AND B. Select a row number to load those input values.
LoadABOutput
FALSEFALSEFALSE
FALSETRUEFALSE
TRUEFALSEFALSE
TRUETRUETRUE

Build an equivalent condition

Scenario 1 / 2

Confirm a booking. Confirm only when payment has arrived AND a seat is available.

A
Payment received
B
Seat available
Inspect the target truth table
Required output for each input combination
ABTarget
FALSEFALSEFALSE
FALSETRUEFALSE
TRUEFALSEFALSE
TRUETRUETRUE
Equivalent expressions are accepted. Every combination is checked, not just the current toggles.
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.

A booking is confirmed only if payment is received AND a seat is available. Payment is TRUE and seat availability is FALSE. Is the booking confirmed?

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 Labs

Loading more Learning Labs…