
Menu
Historical Overview
Definitions
Different names
Operators
Precedence rules
Truth Tables
Examples of Boolean Expressions
Purpose
Usage examples
Quiz
|
Examples of Boolean Expressions
where p=true, q=false, v=true, u=false
p AND q AND v AND u = false
As it can be observed from the truth tables, for an AND expression all the
operands must be true. In this example we can see that on second position the
value is false, thus, the expression evaluates to false.
p OR q OR v OR u = true
Similarly to previous example here we see the true values on first position,
thus, we can already answer that this expression evaluates to true
(p AND q) AND (v OR u) = false
Here we have parenthesis to override precedence. First we evaluate the
expressions in brackets. We get: FALSE AND TRUE which as we already
know evaluates to false.
(p AND q) OR (v OR u) = true
Similarly in this case, by evaluating parenthesized expressions we get:
FALSE OR TRUE which evaluates to true
(p OR q) AND (v OR u) = true
Here we obtain: TRUE AND TRUE, which expression also evaluates to true.
|