Logical Operators

                     Logical Operators are used to combine the results of two or more expressions.

1. Logical AND ( && )

                    The Logical AND ( && ) operator is used to check if the both conditions are True than it's become True, Otherwise the condition is False.

                    Eg:  (x>6) && (y>5)


2. Logical OR ( || )

                    The Logical OR( || ) operator is used to check if the either any one conditions are True than it's become True, Otherwise the condition is False.

                    Eg:  (x>6)  || (y>5)


3. Logical NOT ( ! )

                    The Logical NOT ( ! ) operator is used to check if the condition is True than it becomes False, if the condition is False than it becomes True.

                    Eg:  !(a&&b) than it is True


Logical Operator Table:

A B A&&B A||B !A !B
True True True True False False
True False False True False True
False True False True True False
False False False False True True



Next Topic        :  Assignment Operators

Previous Topic :  Relational Operators

No comments:

Post a Comment