# Logic

## Intro​

Perform simple logic operations (AND, OR, XOR) on boolean (on/off) values.

## UI​

First - Set the first boolean to be used in the operation. When using input connections, a value less than 0.5 is considered false and a value greater than or equal to 0.5 is true.

Operation - Determine the logical operation:

• AND (both) - The Result is true if First and Second are both true.
• OR (one or both) - The Result is true if First and/or Second are true.
• XOR (one but not both) - The Result is true if either First or Second is true but not if both are true.

Second - Set the second boolean to be used in the operation. When using input connections, a value less than 0.5 is considered false and a value greater than or equal to 0.5 is true.

Result - A read only preview of the output. The Logic Utility will output a value of 1 when the result is true and a value of 0 when the result is false.

Example
1. Create an Ellipse.
2. Create two Comparison Utilities.
3. Set Second to 0 for both.
4. Connect ellipse.position.xcomparison1.first.
5. Connect ellipse.position.ycomparison2.first.
6. Create a Logic Utility.
7. Connect comparison1.idlogic.first.
8. Connect comparison2.idlogic.second.
9. Create a Color Array.
10. Using the +Add button add a second index to the Color Array and set a different color.
11. Connect logic.idcolorArray.index.
12. Connect colorArray.idellipse.fill.color.

Using the Select tool, move the Ellipse around the Viewport. When the Ellipse is positioned in the bottom left quadrant of the Viewport it will change color because;

• Its position in both X and Y is less than 0 which means both Comparisons return true.
• This means the Logic also returns true.
• Which sets the Color Array's Index to 1.