Welcome to My Bitesize, let's get you set up!

Add your subjects to find the right study guides, track progress and keep everything in one place.

Add my subjects
My Subjects

Boolean logicWhat is Boolean logic?

When designing programs, there are often points where a condition needs to be tested in order to make a decision. Conditions are formed using Boolean logic.

Part ofComputer ScienceProgramming

What is Boolean logic?

use simple comparisons to help make decisions. is a form of algebra where all are either true or false. These values of true and false are used to test the that and are based around.

Boolean logic is a form of algebra where all values are evaluated to be either True or False. For example 3 is equal to 3 is evaluated as true and 8 is greater than 10 is evaluated as false.

Boolean logic uses algebra and algebraic expressions. Use these expressions in algorithms and programs:

ExpressionBoolean equivalent
Equals=
Greater than>
Less than<
Greater than or equal to>=
Less than or equal to<=
Does not equal<>
AndAND
OrOR
NotNOT
ExpressionEquals
Boolean equivalent=
ExpressionGreater than
Boolean equivalent>
ExpressionLess than
Boolean equivalent<
ExpressionGreater than or equal to
Boolean equivalent>=
ExpressionLess than or equal to
Boolean equivalent<=
ExpressionDoes not equal
Boolean equivalent<>
ExpressionAnd
Boolean equivalentAND
ExpressionOr
Boolean equivalentOR
ExpressionNot
Boolean equivalentNOT

Most programming languages use these equivalent Boolean expressions. However, some, such as , have slightly different equivalents:

ExpressionBoolean equivalentIn Python
Equal to===
Does not equal<>!=
AndANDand
OrORor
NotNOTnot
ExpressionEqual to
Boolean equivalent=
In Python==
ExpressionDoes not equal
Boolean equivalent<>
In Python!=
ExpressionAnd
Boolean equivalentAND
In Pythonand
ExpressionOr
Boolean equivalentOR
In Pythonor
ExpressionNot
Boolean equivalentNOT
In Pythonnot