Iterator
This node steps through an array one item at a time.
The Iterator node maintains a cursor position in a list and advances it on command.
The Iterator node holds a reference to an array and an internal index. Every time the Next signal is triggered, it advances the index and outputs the next item. It allows for manual, step-by-step processing of a list.
Inputs
Input
| Data | Description |
|---|---|
| Array | The array to iterate over. |
Actions
| Signal | Description |
|---|---|
| Next | Advances to the next item and outputs it. |
| Reset | Resets the index to the beginning (before the first item). |
Outputs
Output
| Data | Description |
|---|---|
| Value | The current item. |
Events
| Signal | Description |
|---|---|
| Done | Triggered each time Next successfully advances to a new item. |
Usage
Use this for slideshows, wizards, or processing items one by one with user interaction.
Example Use Cases
- Image Carousel:
- Connect list of Image URLs to Array.
- Connect "Next Button" to Next.
- Connect Value to an Image node.
- Quiz: Show questions one by one.
- Tutorial: Step through instructions.
Detailed Behavior
- Start State: Initially, the index is -1 (no item selected). The first Next moves to index 0.
- End of List: If Next is triggered when at the last item, the index does not advance, and Done is not triggered (indicating end of list).
- Reset: Sets index back to -1 and Value to null.
Troubleshooting
- Stops Working: If you reach the end of the list, you must Reset to start over.