Array Text - For Each Loop - Make one loop even when two index with the same name

Hi everyone,

So my problem is here. I have two same item no my text array and the loop will work only two loop instead of 3 times. I think the loop works only on the different items instead of on the number of indexes.

I think the loop works only on different items instead of on the number of indexes. Do you have any idea how to make it do 3 loops ? without changing the variable type ideally.

The “Hello” on the Print String is just to see how many times it’s appearing.

Try printing out the text, you’ll find it’s working…

2 Likes

You have right. But when I ask to find item then to remove it at a certain index. It just delete one square of the two of them, the pentagon is well erase.

Ah, yes, that will happen.

If you want to specifically remove all similar items, then you need to do it yourself. Bit of advice, if you want to loop over an array and remove items, you need to do it backwards.

Or, if you don’t want it to be possible that you have two identical items, then use a dictionary instead of an array ( map lookup ).

1 Like