Running Head: BOOLEAN EXPRESSIONS 1

Boolean Expressions

Marvin Etienne

COMP 235

BOOLEAN EXPRESSIONS 2

A Boolean expression is an expression that results in a Boolean value, that is, in a value of either 1 (true) or 2 (false). Boolean expressions can take several forms. To truly understand Boolean expressions you have to define the Boolean relationships.

Boolean expressions consist of sequences of 0s, 1s, YES, NO, ON, OFF, TRUE, FALSE, and variable names, known as literals, separated by the Boolean operators AND, OR, NOT, and EXCLUSIVE OR (“Oracle”, 2007). AND is true, and only, if both sides of the expression are true. OR is true if either side of the expression is true or both sides are true. NOT changes true to false and false to true. EXCLUSIVE OR is true if either side is true, but not both sides (Dave, 2013). Each Boolean operator accepts a pair of Boolean inputs and produces a single Boolean output (“Boolean Expressions”, n.d.).

If a single Boolean expression contains more than one Boolean operator, the result of the expression depends on the priority, or precedence, of the operators (“Boolean Expressions”, n.d.). The NOT operator takes precedence over the AND operator, which, in turn, takes precedence over the OR operator (“Visual Basic”, 2013). If two Boolean operators with the same precedence lie next to each other in Boolean expression, you must evaluate them from left to right. You can, however, use parentheses or brackets to override the usual precedence (“Visual Basic”, 2013). In the Boolean expression A*B+C, usual operator precedence dictates that AND (*) takes precedence over OR (+), so the expression would actually be evaluated as (A*B) +C.

BOOLEAN EXPRESSIONS 3

If you wanted to change the order of precedence,...