Iterate backwards to destroy and remove indexes.
If you go into a loop macro you will see this warning:
The point is that after deleting the current element of the iteration, the next element of the array will be skipped.
You need to either create your own macro that will have an Exec pin to delete the current element, which will do it back to one index so as not to miss the next element, or create a buffer that will contain the elements that need to be deleted, and then you will delete them in the next loop.
Thank you for your question and answer, is there a complete sample code?
What you’re doing in the image looks fine, are you having any issues ?
To correctly delete elements in an array loop:
-
Iterate backwards to avoid index shifting.
-
Use splice() for arrays or delete for objects.
-
Consider filter() for a new array without deleted elements.
-
Use a while loop with a condition to remove multiple elements.
-
Be cautious with forEach(), as it can lead to unexpected behavior.




