# Continuous looping

**URL:** <https://forum.uipath.com/t/continuous-looping/255895>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [September 15, 2020, 4:38am UTC](https://forum.uipath.com/t/continuous-looping/255895 "2020-09-15T04:38:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshu\_dayal](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@himanshu\_dayal](https://forum.uipath.com/u/himanshu_dayal)\
**Post date:** [September 15, 2020, 4:38am UTC](https://forum.uipath.com/t/continuous-looping/255895/1 "2020-09-15T04:38:16Z")

</div>

How to do continuous looping in UiPath?

---

<div class="post-metadata">

**Author:** ![KM1996](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@KM1996](https://forum.uipath.com/u/KM1996)\
**Post date:** [September 15, 2020, 4:53am UTC](https://forum.uipath.com/t/continuous-looping/255895/2 "2020-09-15T04:53:18Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![himanshu\_dayal](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@himanshu\_dayal](https://forum.uipath.com/u/himanshu_dayal)\
**Post date:** [September 15, 2020, 3:50pm UTC](https://forum.uipath.com/t/continuous-looping/255895/3 "2020-09-15T15:50:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JosephNehl](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/josephnehl/32/158541_2.png) [@JosephNehl](https://forum.uipath.com/u/JosephNehl)\
**Post date:** [September 15, 2020, 3:57pm UTC](https://forum.uipath.com/t/continuous-looping/255895/4 "2020-09-15T15:57:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![himanshu\_dayal](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@himanshu\_dayal](https://forum.uipath.com/u/himanshu_dayal)\
**Post date:** [September 15, 2020, 3:59pm UTC](https://forum.uipath.com/t/continuous-looping/255895/5 "2020-09-15T15:59:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JosephNehl](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/josephnehl/32/158541_2.png) [@JosephNehl](https://forum.uipath.com/u/JosephNehl)\
**Post date:** [September 15, 2020, 4:05pm UTC](https://forum.uipath.com/t/continuous-looping/255895/6 "2020-09-15T16:05:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![himanshu\_dayal](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@himanshu\_dayal](https://forum.uipath.com/u/himanshu_dayal)\
**Post date:** [September 24, 2020, 8:14am UTC](https://forum.uipath.com/t/continuous-looping/255895/7 "2020-09-24T08:14:41Z")

</div>

Hi Joseph,  
Please let me know.

---

<div class="post-metadata">

**Author:** ![JosephNehl](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/josephnehl/32/158541_2.png) [@JosephNehl](https://forum.uipath.com/u/JosephNehl)\
**Post date:** [September 24, 2020, 1:37pm UTC](https://forum.uipath.com/t/continuous-looping/255895/8 "2020-09-24T13:37:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![himanshu\_dayal](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@himanshu\_dayal](https://forum.uipath.com/u/himanshu_dayal)\
**Post date:** [September 25, 2020, 11:58am UTC](https://forum.uipath.com/t/continuous-looping/255895/9 "2020-09-25T11:58:03Z")

</div>

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