Friday, January 15, 2010

Logical Operator

In a decision, we usually use Relation Operator to make a condition.
But sometime we need to combine more than one condition for one statement decision.
To do that, we need to use Logical Operators.
They are:
1. AND with the symbol is &&
2. OR with the symbol is ||
3. NOT with the symbol is !

With those Logical Operators, we can combine two conditions which has each value (TRUE or FALSE), so those two conditions will have only one value (TRUE or FALSE)

See and learn the table below:
1. Table for AND ( && )


2. Table for OR ( || )


3. Table for NOT ( ! )


Let’s see some example:
(5==5)||(6==7) has TRUE value
(8<=2)||(9<6) has FALSE value
(5>=6) && (3==3) has FALSE value
(7 > 4) && (5<=10) has TRUE value

For the sample complete syntax using those operators, see the next post.


0 comments:

Post a Comment