How to remove all item types that are not of a specific type from my array.

I’m floating here. What am I doing wrong? Even removing all similar instances, some remain and are unique. :thinking:

You can’t remove items from an array while you’re looping over it ( the macro doesn’t take that into account and get the index numbers muddled up ).

The way to do that is to copy the ForEach macro, and convert it to run backwards ( from end to start ), then you can remove items during the loop :slight_smile:

1 Like

Funny that I was wondering exactly if this was happening and it was. I researched exactly this and it turned out that the for each loop skips the index because the array is resizing. Well, anyway, here is the explanation and how to solve it. I’ll leave this post open in case anyone has any further questions.

Thank you very much also for your answer @ClockworkOcean :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.