Boolean Expressions

A Boolean expression is a question 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 equation 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 an inequality like, “3+2 <= 6.” This time the inequality is evaluated as, “True” since 5 is less than or equal to 6. Some of the most common operators for Boolean expressions in computer science are:



== or eq

Equal to


Less than


Greater than


Less than or equal to


Greater than or equal to

<> or !=

Not equal to