In the interest of keeping the code quality high while also maintaining the head on your hair, I would recommend you use Queues.
Upon starting, convert each row into a queue item and then use them as you need. That way, you won’t need to remove the rows from datatable or face concurrent modification issues (such as - removing rows from a table whilst still iterating it).
Thanks @ppr I had initially used this too. Let’s say there are 150 rows, how would you approach the next loop taking care of just the remaining 50 rows that have not been dealt with, and If statement and Counter?
Oh sorry, I misunderstood. It looks like ppr mentioned the .skip(counter).take(amount) way, which is the way I always have handled things as well since I like the simplicity and ease of reading. Then after the loop you just update the counter to be counter = counter + amount This way on the first iteration counter = 0, then second time it is 100, etc
I think your answer is best & generally the simplest, but in a lot of workflows I try to avoid using “math tricks” for readability because a lot of uipath developers are new to programming or don’t have much background in it. It is harder to tell immediately what it’s doing (modulo isn’t a common concept for non-programmers).
Commenting or annotating should fix that issue of course, but I just go with the things that make more sense and are easier to maintain for the most people