Do something to each item in a list

Abstract

How to iterate through a list

Process List and Build List are Vuo's general-purpose nodes for iteration. They're similar to text programming constructs such as loop control structures and foreach and apply functions.

The previous section showed how to do something with each list item in turn, using a Cycle through List node. For each event the Cycle through List node receives, it outputs one list item. If instead you want an event to do something to all list items, you can use the Process List node.

Here’s an example (File > Open Example > List > Display Grid Of Images) that turns a list of images into a list of layers using Process List. When Process List gets an event and list of images into its Start Processing port, it rapidly fires a series of events through its Item port, one event for each image in the list. The image and event go through the Make Image Layer node, and the created layer and event go into the Process List node’s Processed Item port. Once that port has received as many events as Item fired, the Finished Processing port fires an event with the accumulated list of created layers.