Array node
Array Contains
Check if a value exists in an array and find its position. Returns whether the value was found, its first index, last index, and total number of occurrences. Float comparison uses epsilon tolerance.
Inputs
| Port | Type | Default |
|---|---|---|
| ArrayThe list to search through. An empty list reports not found, with index -1. | any | — |
| ValueWhat to look for. Numbers match within the tolerance, text and switches must match exactly. | any | — |
| EpsilonHow close a number must be to count as a match. Not clamped; the default 0.0001 catches rounding noise, larger values start matching neighbours too. | float | 0.0001 |
Outputs
| Port | Type |
|---|---|
| Found | bool |
| Index | int |
| Last Index | int |
| Occurrences | int |
How It Works
Array Contains searches the array for the specified Value. For float comparisons, values within Epsilon are considered equal.
- Found: True if the value exists anywhere in the array.
- Index: The zero-based position of the first match (-1 if not found).
- Last Index: The position of the last match (-1 if not found).
- Occurrences: Total count of matching elements.
Use Cases
- Value validation: Check if a specific DMX channel or MIDI note is present in a data stream.
- Duplicate detection: Test whether a new value already exists before appending to an Array Set.
- Threshold checking: Search for zero-crossings or specific values in signal data.
- Position tracking: Find where a known value appears in a sorted or ordered array.
Tips
- Index returns -1 when the value is not found — use this with a Compare node or Switch to handle the "not found" case.
- For removing all occurrences of a value, combine the Found output with Array Filter.
Open Array Contains in the interactive catalog →
Array Contains 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.