Knowledge Base

Logical Operator Block

output-onlinepngtools__231_.png  This block works for both EV3 Robot and Ruby Robot!  output-onlinepngtools__101_.png

The Logical Operator block returns a Boolean value (True/False) based on the result of two (or more) expressions.

For example, using the Logical Operator block, the following program checks two expressions - that the Touch sensor is not pressed and that the Ultrasonic sensor is far from an obstacle. If both those expressions are true, the robot drives forward.

There are three configurations for the Logical Operator block that can be selected using its drop-down menu:

Operator Description
and Returns a true value if both operands (expressions) are true.
or Returns a true value if at least one of the operands (expressions) are true.
xor Returns a true value if only one of the operands (expressions) are true, or returns a false value if both operands are either true or false.
Was this article helpful?
0 out of 0 found this helpful

Comments

Please sign in to leave a comment.

Powered by Zendesk