Continuous looping

How to do continuous looping in uipath?

Hi @himanshu_dayal, are you trying to have an infinite loop which will only stop when the bot is stopped? There is a simple way to do it. Just use a While or Do While loop with the condition such as “a = 1” in an Assign activity outside the loop, and do not increase or decrease the value anywhere. Thus all activities within the loop will be executed continuously. Hope this helps!

1 Like

Thanks for response. how can we stop a continuous loop if the condition is met?

Like @KM1996 stated this can be accomplished with a while or do while loop. It is important you make sure you don’t have an infinite loop however. Make sure that whatever you do inside the loop has a chance to make the condition false to break out of the loop (or you could use a break activity as well) otherwise you could run into issues.

If the condition you set is at any point false when running a while loop it will break out once the program tries to loop again (entry condition).

For a do while loop it is very similar to the while loop however it will always run at least once even if the condition is not met (exit condition).

For a break activity this can be placed anywhere inside the loop (though it is most commonly inside of a switch/if statement) and will end the loop as soon as the code runs into that break statement.

1 Like

Thanks Joseph. I wanted to know the activity which will help me to break the loop. thanks a lot.

1 Like

I went into a little more detail regarding each of the different ways a loop could be broken in an edit of my previous post, if you need any more info please ask!

Hi Joseph,
Please let me know.

If you want to manually exit the loop, like mentioned in my previous post, you can use a break activity.

Like also stated, you can set exit conditions for while and do while loops as well.

Is there something else confusing you?

No, I guess that’s perfectly helpful. thanks.