Tutelage

Lessons › coding and computer science · taught by Leo

Boolean logic basics: true, false, AND, OR, NOT

Learn what Boolean logic means, how true/false values work, and how NOT, AND, and OR combine to make final results.

Learn this with Leo, freeA voiced lesson with a live whiteboard, quizzes and a tutor you can call, at tutelage.app

What Boolean logic means

Boolean logic is the language of yes or no. In computing, that usually means false or true.

Think of a switch. One state lets current through, and the other state blocks it.

That simple yes-or-no idea is the whole base of Boolean logic.

Two truth values only

Boolean values are just true and false.

A Boolean is not a number here. It is one of two states: true or false.

So every Boolean expression must end up in one of those two states.

Predict a Boolean result

If a statement is true and you use NOT, what happens?

  1. It becomes false
  2. It stays true
  3. It becomes 2
Show answer

It becomes false: Nice. NOT flips the truth value.

NOT flips one value

NOT is the simplest operator. It just flips true to false, or false to true.

Watch the flip happen on both examples. Same rule, both directions.

This matters because NOT changes one statement, not two.

NOT

Quick check on AND

For AND, when is the result true?

  1. Only when both parts are true
  2. When at least one part is true
  3. Whenever the first part is true
Show answer

Only when both parts are true: Yes. AND is strict: both sides must be true.

AND needs both sides true

AND acts like a team test. Both parts have to pass.

If either side is false, the whole AND is false.

OR is more generous. One true part is enough.

A AND B A OR B

Why AND is strict

AND asks for two true facts at the same time.

Imagine two doors that both must open before you can go through.

If one door stays shut, the path stops. That is why AND needs both true.

Worked example: evaluate A AND NOT B

Let’s do one full example. Suppose A is true and B is false.

First handle NOT B. Since B is false, NOT B becomes true.

Now combine them. A and NOT B are both true, so the answer is true.

NOT B A AND NOT B

Spot the next move

In A AND NOT B, what should you do first?

  1. Evaluate NOT B first
  2. Decide the final answer immediately
  3. Turn AND into OR
Show answer

Evaluate NOT B first: Exactly. Do the inside part first, then combine.

Watch out: mix up AND and OR

A common mistake is treating AND like OR.

Remember the difference: AND is strict, OR is flexible.

NOT is different again. It never combines two statements.

AND ≠ OR

Your turn: final result

If C is true and D is true, what is C OR NOT D?

  1. true
  2. false
  3. cannot tell
Show answer

true: Correct. NOT D is false, and true OR false is true? Wait—careful: the correct result is true.

Recap: the Boolean checklist

Here is the checklist you can use alone.

First, read the given truth values.

Second, handle NOT. Third, combine with AND or OR. Last, name the final truth value.

Learn this with Leo, freeA voiced lesson with a live whiteboard, quizzes and a tutor you can call, at tutelage.app