What is Boolean logic?

Programs use simple comparisons to help make decisions. Boolean logic is a form of algebra where all values are either True or False. These values of true and false are used to test the conditions that selection and iteration 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. We 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

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

ExpressionBoolean equivalentIn Python
Equal to===
Does not equal<>!=
AndANDand
OrORor
NotNOTnot