GoConqr has a new look! Let us know what you think.

Module 8 of 18 · Media

Logical Ops

Kostas Diakogiannis

Logical Ops

Logical Operators

 

Logical operators are used in order to group boolean values or boolean expressions together and make decisions based on, if all of them, one of them  or none is true.

There are 3 Logical operators and all of them return boolean values:

The AND  operator: &&. That checks if both conditions are true and evaluates to true. If only one of the conditions that are being checked is false then the whole logical operation evaluates to false. For example i am going to buy myself an ice cream ONLY when i have enough money for it (so the money in my wallet is bigger number than the price of the ice cream) AND if the temperature is more than 25 degrees! If one of these conditions evaluate to false then the whole condition is false. BOTH have to be true in order to buy the ice cream. We group this condition with the AND (&&) operator.

The OR operator: ||. Checks if one condition of the group is true. If so it evaluates the whole operation to true. Either the one or the other one is enough to evaluate to true.

The NOT operator:  ! Checks if something is not true. (see comparison operators also).

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?