It does seem to me the only way to exit the sequence in the Parallel For Each is to use the throw activity.
Is there other alternative? cuz this make exception handling much more complex to write.
Yes, but here’s the error studio shows. I guess Parallel For Each is not a traditional loop

that’s sad. It should be provided ready to use. Let’s reinvent the wheel ![]()
Here is one of the approach I can think of late night at my place ![]()
Printing Even Number and Continuing on Odd numbers.
Output:

Thanks,
Ashok ![]()
Thank you for making the time. That’s exactly what i’m settling with right now.
The downside of this approach is this would result in nested ifs if we’re dealing with multiple points where the sequence needs to exit. And nested ifs are horrible to read and maintain.
The true resolution is: I think UiPath should make another Continue for Parallel for Each loop lol
If no cleaner approach available than this then I think readability and maintainability we will have to maintain in annotations.
Couldn’t agree more. C# already provides the solution return for this so I think UiPath should take a look into it and add this feature.
I vote for this. Anyone reading this, don’t forget to upvote ![]()
Thanks,
Ashok ![]()
We will see what is possible here. For now - maybe doing it like this would help?
