Remove item problem

Hello, I am trying to delete items in a product list which contain a variable (here the name of the batch).
But a priori it deletes the products except 1 and it gives me this message:
List index too large
Remove list item:attempt to remove item3 from a list length 1.
However, it erased 2 out of 3 products.

I know this problem is often discussed but I can’t find an answer.
Here is part of the code. Basically I want it to delete from my list of products that are in the lot that I will have scanned with barcode scanner.
I ask him to search for all the products in a batch and delete them for me.

Ser this thread and start deleting from the end of the list in direction to the beginning

Taifun

Thank you but in fact I’m trying to go through a list (each item) and each time we encounter a term it deletes it (if…then loop).
I don’t really see how to do it
But thank you for your help
Fred

Try using a temp list

I use this block and for me it is ok for the moment…

You forgot to read the complete thread… I explained it there in detail…

Taifun