Logical Operators

Logical operators are used to combine or modify conditions

AND Operator

The AND operator checks if both conditions are true. The result is true only if both conditions are true.

AND operator purpose

The AND operator is used to check if two conditions are both true.

Example
“The password must contain a number AND a special character to be valid.”

Condition A Condition B A AND B
True True True
True False False
False True False
False False False

NOT Operator

The NOT operator reverses a condition.

  • If a condition is true, NOT makes it false.
  • If a condition is false, NOT makes it true.

NOT operator purpose

The NOT operator is used to reverse a condition.

Example
“Show all results NOT containing the word ‘Glasgow’.”

Condition A NOT A
True False
False True

Targets

State the purpose of the AND operator

State the purpose of the NOT operator

State the output of an AND truth table

State the output of a NOT truth table