Logic Operations Block

The Logic Operations block does a Logic operation on its inputs, and outputs the result. A Logic operation takes inputs that are True or False, and produces a True/False output. The Logic operations available are AND, OR, XOR, and NOT.
Logic Operations
Mode Selector
Inputs
Output
Choose the Logic operation you want to use by selecting a mode with the Mode Selector. The block will calculate the Result based on the Inputs, as shown in this table.
ModesInputs UsedResult
AND A, BTrue if both A and B are True,
otherwise False
OR A, BTrue if either A or B (or both) is True,
False if both A and B are False
XOR A, BTrue if exactly one of A and B is True,
False if both A and B are True,
False if both A and B are False
NOT ATrue if A is False,
False if A is True
Example
This program will make a robot drive forward until either the Touch Sensor is pressed or the Color Sensor detects black. It uses the Logic OR mode to combine the outputs of two sensor blocks into a single True or False result. A result of True tells the loop to end, and then the robot is stopped.
Inputs and Outputs
The inputs of the Logic Operations block provide the values for the Logic operation. Typically, you will supply both of the input values with Data Wires from the outputs of other Programming Blocks.
InputsTypeAllowed ValuesNotes
A LogicTrue/False
B LogicTrue/FalseNot used in NOT mode
The output of the block gives the result of the operation. To use the output, use a Data Wire to connect it to another Programming Block.
OutputTypeNotes
Result LogicResult of the Logic operation (True or False)
Logic
Quick links