Math node
Logic
Performs standard boolean logic operations on two inputs. The operation is selected via a picker on the middle port, supporting AND, OR, XOR, NOT, NAND, NOR, and NXOR.
Inputs
| Port | Type | Default |
|---|---|---|
| AThe first switch input. Numbers count as true whenever they are not zero. Also accepts an ARRAY — runs element-wise, Result becomes a bool array. | bool | false |
| ANDWhich logic operation to run — AND, OR, XOR, NOT, NAND, NOR or NXOR. The port label follows your choice, NOT drops the B input, and values outside the list fall back to AND. | int | 0 |
| BThe second switch input. Numbers count as true whenever they are not zero; this port disappears while NOT is selected, and its cable is dropped with it. Arrays run element-wise (a single bool broadcasts). | bool | false |
Outputs
| Port | Type |
|---|---|
| Result | bool |
How It Works
The Logic node evaluates a boolean operation on inputs A and B and outputs the result. The operation is chosen through the middle port, which acts as a picker with the following options:
| Operation | Description |
|---|---|
| AND | True only when both A and B are true |
| OR | True when at least one of A or B is true |
| XOR | True when exactly one of A or B is true |
| NOT | Inverts A (B is ignored) |
| NAND | True unless both A and B are true |
| NOR | True only when both A and B are false |
| NXOR | True when A and B have the same value |
The NOT operation uses only the A input; the value of B has no effect on the result.
Use Cases
- Combining multiple boolean conditions (e.g., "key pressed AND mouse inside region")
- Inverting a boolean signal with NOT
- Building toggle logic with XOR (flip a state each time a trigger fires)
- Creating enable/disable gates that require multiple conditions to be met
- Implementing exclusion logic where only one of two conditions should be active
Tips
- Chain multiple Logic nodes to build complex conditional expressions
- NOT ignores input B entirely, so only connect A when using it
- NXOR (equivalence) is useful for checking whether two signals agree
- Connect the picker port to a dynamic source if you need to switch operations at runtime
- Combine with Compare nodes to turn numeric conditions into boolean inputs for logic chains
Open Logic in the interactive catalog →
Logic is one of 381 nodes in Grafit Pro.
Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.