Logical operation¶
Perform a logical operation with two input variables. These operations can be used to logically combine two Bool variables. The operations AND, OR, XOR, NAND, NOR and XNOR are available. The behaviour of these operations can be seen in the truth tables shown below.
Variables¶
Input/Output |
Name |
Type |
Description |
|---|---|---|---|
Input |
Input 1 |
Bool |
Operand 1 |
Input |
Input 2 |
Bool |
Operand 2 |
Input |
Operation |
Parameter |
Selection of logical operation:
|
Output |
Result |
Bool |
Result |
Truth tables¶
The following tables list all possible combinations of two inputs and the corresponding result values for each of the available Boolean operations.
AND¶
The result is True only if both inputs are True (logical ‘and’ operation).
Input 1 |
Input 2 |
Result (AND) |
|---|---|---|
False |
False |
False |
False |
True |
False |
True |
False |
False |
True |
True |
True |
OR¶
The result is True if at least one input is True (logical ‘or’ operation).
Input 1 |
Input 2 |
Result (OR) |
|---|---|---|
False |
False |
False |
False |
True |
True |
True |
False |
True |
True |
True |
True |
XOR¶
The result is True if exactly one input is True, but not both (exclusive ‘or’ operation).
This operation is also known as logical inequality, because the result is only true if the two inputs are different (i.e. one is true and the other false, but not both true or both false at the same time).
Input 1 |
Input 2 |
Result (XOR) |
|---|---|---|
False |
False |
False |
False |
True |
True |
True |
False |
True |
True |
True |
False |
NAND¶
The result is False only if both inputs are True; otherwise, it’s True.
The NAND operation is the logical complement of the AND operation, i.e. it produces exactly the opposite result of the logical AND operation.
Input 1 |
Input 2 |
Result (NAND) |
|---|---|---|
False |
False |
True |
False |
True |
True |
True |
False |
True |
True |
True |
False |
NOR¶
The result is True only if both inputs are False.
The NOR operation is the logical complement of the OR operation, i.e. it produces exactly the opposite result of the logical OR operation.
Input 1 |
Input 2 |
Result (NOR) |
|---|---|---|
False |
False |
True |
False |
True |
False |
True |
False |
False |
True |
True |
False |
XNOR¶
The result is True if both inputs are the same (both True or both False).
This operation is therefore also known as logical equality and is the logical complement to the XOR operation.
Input 1 |
Input 2 |
Result (XNOR) |
|---|---|---|
False |
False |
True |
False |
True |
False |
True |
False |
False |
True |
True |
True |