For each loop with deletions

11 views Asked by At

I am using iPaaS currently since it integrates with our system. I have two lists of users, list A and list B. Currently I have a for each loop that will go through each user in list B and check to see if the user is in list A. If the user is not in list A, then the user is deleted from list B which is working. The problem I am having is when the first user in list B is deleted, it will skip the 2nd user in the list and go to the 3rd user. Is there any way to get around this so the for each loop will go through each user in the list instead of skipping users?

For example:

If these are the list of names originally in list B and Johnny is not found in list A, Johnny is deleted and when the for each loop restarts, it moves to David and skips Carol.

List B:

Johnny

Carol

David

Aaron

Patrick

I tried a for loop instead and didn't have any luck.

0

There are 0 answers