A more complex Boolean expression can be built of simpler Boolean expressions and can be written as
Boolean_Expression1 Logical Operator Boolean_Expression2
where
Boolean_Expression1
andBoolean_Expression2
can be any Boolean expressionLogical Operator
can be one of those shown in the table that follows
PHP, Java, C++, C#
Logical Operator 
Description 
&& 
AND (also known as logical conjunction) 
 
OR (also known as logical disjunction) 
! 
NOT (also known as negation or logical complement) 
The truth table for all three operators is shown here.
Boolean Expression1 (BE1) 
Boolean Expression2 (BE2) 



False 
False 
False 
False 
True 
False 
True 
False 
True 
True 
True 
False 
False 
True 
False 
True 
True 
True 
True 
False 
Are you still confused? You shouldn’t be! It is quite simple!
 The result of the logical operator AND ( && ) is true when both BE1 and BE2 are
true
.  The result of the logical operator OR (  ) is true when either BE1 or BE2 is
true
(at least one).  The logical operator NOT ( ! ) just reverses the result of a Boolean expression. In this table, when BE1 is
true
the result isfalse
and vice versa.
Notice: In flowcharts, this website uses the commonly accepted AND, OR, and NOT operators!
Next are some examples of complex Boolean expressions. The parentheses are not really necessary. They are used just for increased readability.
(x == 5) && (x > y)
. This can be read as “test ifx
is equal to 5 and greater thany
”(x > y)  (x == 3)
. This can be read as “test ifx
is greater than y or equal to 3”!(x < y)
. This can be read as “test ifx
is not less thany
” or, in other words, “test ifx
is greater than or equal toy
”
Notice: In the last Boolean expression, please note the exclamation mark in the front.
Visual Basic
Logical Operator 
Description 
And 
Also known as logical conjunction 
Or 
Also known as logical disjunction 
Not 
Also known as negation or logical complement 
The truth table for all three operators is shown here.
Boolean Expression1 (BE1) 
Boolean Expression2 (BE2) 



False 
False 
False 
False 
True 
False 
True 
False 
True 
True 
True 
False 
False 
True 
False 
True 
True 
True 
True 
False 
Are you still confused? You shouldn’t be! It is quite simple!
 The result of the logical operator
And
is true when both BE1 and BE2 aretrue
.  The result of the logical operator
Or
is true when either BE1 or BE2 istrue
(at least one).  The logical operator
Not
just reverses the result of a Boolean expression. In this table, when BE1 istrue
the result isfalse
and vice versa.
Next are some examples of complex Boolean expressions. The parentheses are not really necessary. They are used just for increased readability.
(x = 5) And (x > y)
. This can be read as “test ifx
is equal to 5 and greater thany
”(x > y) Or (x = 3)
. This can be read as “test ifx
is greater than y or equal to 3”Not(x < y)
. This can be read as “test ifx
is not less thany
” or, in other words, “test ifx
is greater than or equal toy
”
Python
Logical Operator 
Description 
and 
Also known as logical conjunction 
or 
Also known as logical disjunction 
not 
Also known as negation or logical complement 
The truth table for all three operators is shown here.
Boolean Expression1 (BE1) 
Boolean Expression2 (BE2) 



False 
False 
False 
False 
True 
False 
True 
False 
True 
True 
True 
False 
False 
True 
False 
True 
True 
True 
True 
False 
Are you still confused? You shouldn’t be! It is quite simple!
 The result of the logical operator
and
is true when both BE1 and BE2 aretrue
.  The result of the logical operator
or
is true when either BE1 or BE2 istrue
(at least one).  The logical operator
not
just reverses the result of a Boolean expression. In this table, when BE1 istrue
the result isfalse
and vice versa.
Next are some examples of complex Boolean expressions. The parentheses are not really necessary. They are used just for increased readability.
(x == 5) and (x > y)
. This can be read as “test ifx
is equal to 5 and greater thany
”(x > y) or (x == 3)
. This can be read as “test ifx
is greater than y or equal to 3”not(x < y)
. This can be read as “test ifx
is not less thany
” or, in other words, “test ifx
is greater than or equal toy
”
Leave a Reply