Boolean Expressions

A boolean expression is an expression (or equation) that has two possible values or outcomes, either a “True” or a “False” (or you can look at it as a 1 or a 0). An example of a boolean expression is “A Volkswagen beetle is a car.” Clearly this statement is true, so that is how it is evaluated to “True”. You could also have “a frog is a mammal”. This statement is not correct, so it evaluates to “False”. You could also have mathematical expression, “3+2 = 6”. This equation (and yes it is an equations so you read the “=” as “is equal”) is not correct, so it is also evaluated to “False”. There are many other types of expressions that can be checked, besides equality. You could have “3+2 <= 6”. This time the inequality is evaluated as “True”, since 5 is <= to 6. Some of the most common operators are:

Operator

Meaning

== or eq

Equal to

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

<> or !=

Not equal to