Using modulo to do something different for odd and even values of a repeat loop counter


If you have a Repeat with Counter setup in an ICE tree, and you want to do one thing for odd values of the loop counter, and another thing for even values, you can use the Modulo node.
Doing a modulo by 2 on the loop counter (self.CounterValue) will tell you whether the loop counter is odd (modulo by 2 = 1) or even (modulo by 2 = 0)

Here’s a [super simple] example that populates an array with different values based on whether the loop counter is odd or even.
Click to view full size.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s