Loops
Looping in Midio is as simple as connecting nodes in a loop. This can however easily create infinite loops if we don’t branch out of the loop at some point.
There are two main helper functions in Midio that makes it easy to prevent infinite loops:
For

The For
node allows you to repeat a sequence of nodes a set number of times, determined by the iterations
input.
Start the loop by triggering the
reset
input.For
will then activate theon count
output trigger once per iteration, up to the specified number of times.To continue looping, connect
on count
to the next node(s) in your sequence, and then back to thecount
input ofFor
. This advances to the next iteration.Once all iterations are complete, the
done
output trigger is activated.
For Each

The For Each
node allows you to loop through a list of items, executing a sequence of actions for each item in the list. Unlike a standard For
loop that runs a fixed number of times, For Each
automatically iterates over every element in a list, passing along both the current item
and its index
in the list.
Trigger the loop by activating the
reset
input.For each item in the list,
For Each
activates theon item
output trigger.The
item
output provides the value of the current element, while theindex
output gives its position in the list.Once all items have been processed, the done output trigger is activated.
Last updated
Was this helpful?