Very often I find myself using this pattern:
Every time an event fires, I increment an integer:
Then I use that integer to access some element of an array:
That’s great, until my integer gets larger than the length of my array. I have to do this whole rigamarole to get it back to zero when necessary:
Is there an easier way to loop an integer back to zero once it gets larger than some number (for instance, the length of an array). I haven’t been able to find anything in the docs. Basically it’s just a macro for the third screenshot above.