Creating Boolean Formulas

Objectives

After completing this lesson, you will be able to:

  • Display True/False result using Boolean formula

Boolean Overview

Understanding a Boolean formula.

Creating a Boolean Formula

Boolean operators are used to create conditions that require a logical relationship between two or more values. Conditions that use Boolean operators are called Boolean expressions.

  • A and B means that both A and B must be true for the condition to be satisfied (to return a True value).

  • A or B means that either A or B (or both) must be true for the condition to be satisfied (to return a True value).

Examples of Boolean Operators

Several useful examples of Boolean operators include the following:

  • And

  • Or

  • Not

The AND Operator

The And operator joins the value of x and y. The And operator takes two expressions that evaluate to a Boolean. The expression evaluates True only if both x and y are true. All other combinations result in a value of False.

Value of xValue of yx and y
TrueTrueTrue
TrueFalseFalse
FalseTrueFalse
FalseFalseFalse

The OR Operator

The Or operator takes two expressions that evaluate to a Boolean. If either expression evaluates True, the operator returns True. If both expressions evaluate False, the operator returns False.

Value of xValue of yx and y
TrueTrueTrue
TrueFalseTrue
FalseTrueTrue
FalseFalseFalse

The NOT Operator

The NOT operator reverses the True or False value of x.

Value of xNot x
TrueFalse
FalseTrue

Log in to track your progress & complete quizzes