Wednesday, 10 August 2011

More Advanced Boolean Expressions

0 comments
 
ou can combine the operators "Not", "And" and "Or" in
the same boolean expression, using the parentheses "(" and ")"

For example:

(True And False) Or (Not False) = True

The priority of the "Not" operator is higher than
the priority of "And" and "Or" operators.

For example:

Not True And False = False, because
The first operater to be executed is the "Not" (Figure 6):
Not True = False.
Then we get the following boolean expression:
False And False = False.
If we will executed the "And" operator before
the "Not" operator, we would get WRONG answer

A Teaser:
What will be printed on the form after
executing the following code?

Dim Elvis As Boolean
Elvis = (Not False And True) And Not ((True And Not False) Or False)
Print Elvis


Answer:
 







Leave a Reply