Boolean Arithmetics

Boolean is a type of a logic gate which takes one or more values and after performing a certain logic operation outputs a value of TRUE or FALSE.
Here are examples of the gates in UE4:

The gates are: AND, OR, NAND, NOR, NOT, XOR, XNOR
In the following examples we treat TRUE as ‘1’ and FALSE as ‘0’

AND:

Outputs the result ‘1’ when the input values are also `1`
Output Input 2 Input 1
0 0 0
0 1 0
0 1 0
1 1 1
For example:
In the image above, only if you found both the first and second keys, you can unlock the elevator.

OR:

Outputs the results ‘1’ when at least one of the input values is ‘1’
Output Input 2 Input 1
0 0 0
1 1 0
1 0 1
1 1 1
If you found the cow, the fish or the chicken, you can make dinner (it doesn’t matter if you found all the animals or just one).

NOT:

Reverses the input: ‘1’ turns to ‘0’ and ‘0’ turns to ‘1’

NAND:

A combination of AND and NOT. Does the same operation as AND, with the output reversed.
Output Input 2 Input 1
1 0 0
0 1 0
0 0 1
0 1 1

NOR:

A combination of OR and NOT. Does the same operation as OR, with the output reversed.
Output Input 2 Input 1
1 0 0
0 1 0
0 0 1
0 1 1

XOR:

Outputs ‘1’ when an odd number of inputs is ‘1’, In case of two inputs only – one is ‘1’ and the other ‘0’. It’s Exclusive OR: that means either of the two but not both.
Output Input 2 Input 1
0 0 0
1 1 0
1 0 1
0 1 1
In the example above, you have two switches which will turn on the light, no matter which one you press.

XNOR:

A combination of XOR and NOT, does the same operation as XOR, with the output reversed. In other words, XNOR returns ‘1’ when the number of ‘1’ inputs is even. Note that 0 is an even number.

Note: XNOR is not part of UE4, but you can build it yourself by using the output of XOR as input for NOT.

Output Input 2 Input 1
1 0 0
0 1 0
0 0 1
1 1 1