Boolean operators

The operators which work on Boolean expressions are as follow.
SymbolMeaning
&&logical and
||logical inclusive or
!logical not (complement)
Order of evaluation remains mostly left to right, except where rules of precedence override this.

and &&

Takes two expressions and produces the true if both of them are true, otherwise produces false.
xyx&&y
ttt
tff
ftf
fff

or ||

Takes two expressions and produces true if either has value true. If both are false, produces false.
xyx||y
ttt
tft
ftt
fff

not

This takes a single Boolean expression and reverses its value.
y!y
tf
ft

Exercises on this section.


Next - bit oerators.

Back to expressions.

Back to Contents page.