How to break a While loop/Do while loop

studio
uipath

#1

How to break a While loop/Do while loop. Break activity is not working, seems it will work only for for each.


#2

Hello,

Maybe this will help,

Regards


#3

Hello!

A While Loop/Do Loop, must have a condition to met. Try to do a If when you need to exit the loop which will give the condition to exit the loop :slight_smile:

Regards,


#4

I am clueless as to why the Try Catch method would not be considered as good practice.

Essentially you catch an exception (maybe element doesn’t exist, row end, pagination end etc etc) and update a value that does not satisfy the Do WHile/WHile VB Expression, eventually ending it. (An exception is basically developer defined and there is no hard and fast rule in that regard)

There have been requests for ‘Continue’ options and break options for While (not so relevant), but a workaround that helps you achieve the objective without shortcomings can also be considered.

Tell me what you think.