Modulo
This node calculates the remainder after division of two numbers.
The Modulo node performs the modulo operation to find the remainder of division.
The Modulo node calculates the remainder when the first number is divided by the second number. This operation is useful for cyclic calculations, array wrapping, and determining divisibility.
Numbers
| Data | Description |
|---|
| First Number | The dividend (default: 0) |
| Second Number | The divisor (default: 1) |
Actions
| Signal | Description |
|---|
| Do | Triggers the modulo calculation |
Outputs
| Data | Description |
|---|
| Result | The remainder of the division |
| Signal | Description |
|---|
| Done | Triggered when the calculation is complete |
Usage
Example Use Cases
- Cyclic Operations: Wrap array indices or create repeating patterns
- Even/Odd Detection: Use modulo 2 to determine if numbers are even or odd
- Time Calculations: Convert minutes to hours and minutes, seconds to time units
- Game Development: Create circular movement patterns or repeating events
Examples
| First Number | Second Number | Result |
|---|
| 10 | 3 | 1 |
| 15 | 4 | 3 |
| 8 | 2 | 0 |
| -7 | 3 | -1 |
| 25 | 10 | 5 |
Error Handling
- Division by zero protection (same as Division node)
- Input validation for valid numbers
- Range checking for results