How to set a threshold in a for each loop

Hi there,

I want to use a counter for a for each loop, so with an input parameter of “5” I want to do an action 5 times. I’ve seen that the input parameters for a for loop are “pos” and “list”. The “list” I’ve seen used and know what it does, but what does “pos” stand for, and could I use it as a threshold value or something to that effect?

Thanks :slight_smile:

Hey Mila,
you can use the “pos” parameter to exit the forEach after 5 iterations. It starts at 1 and is updated after each iteration. I have only ever used the pos parameter as a “read only” value. You can set it to a custom value if you do not want to start counting at 1.

Example:


Thank you! You are amazing, as always :smiley:

1 Like