# Continuous if-statement in UR-Script

**URL:** <https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565>\
**Category:** URScript\
**Created:** [August 21, 2018, 3:08pm UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565 "2018-08-21T15:08:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marvin.kaphengst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/marvin.kaphengst/32/1246_2.png) [@marvin.kaphengst](https://forum.universal-robots.com/u/marvin.kaphengst)\
**Post date:** [August 21, 2018, 3:08pm UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/1 "2018-08-21T15:08:49Z")

</div>

Hi,

in Polyscope I can check the box “Check condition continuously” for if-statements. How can I manage to do that in UR-Script programming?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [August 21, 2018, 10:36pm UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/2 "2018-08-21T22:36:27Z")

</div>

Use a while loop. That’s what a checked if statement turns into when polyscope converts to script.

---

<div class="post-metadata">

**Author:** ![anon42905246](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@anon42905246](https://forum.universal-robots.com/u/anon42905246)\
**Post date:** [August 22, 2018, 4:59am UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/3 "2018-08-22T04:59:30Z")

</div>

To extend @mbush answer:  
If you want to see how exactly this is done, open `.script` file, that is generated after you run `.urp` program.

---

<div class="post-metadata">

**Author:** ![marvin.kaphengst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/marvin.kaphengst/32/1246_2.png) [@marvin.kaphengst](https://forum.universal-robots.com/u/marvin.kaphengst)\
**Post date:** [August 22, 2018, 7:24am UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/4 "2018-08-22T07:24:20Z")

</div>

Thanks a lot for your answers. I thought there might be some special if-statement I could use but I can also do it with the while loop and see how it is done with the conversion from Polyscope to UR-Script.

---

<div class="post-metadata">

**Author:** ![elvintoh82](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@elvintoh82](https://forum.universal-robots.com/u/elvintoh82)\
**Post date:** [August 28, 2018, 4:38pm UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/5 "2018-08-28T16:38:53Z")

</div>

To be more specific, it actually makes use of a thread and a while loop to constantly monitor the variable.

---

<div class="post-metadata">

**Author:** ![marvin.kaphengst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/marvin.kaphengst/32/1246_2.png) [@marvin.kaphengst](https://forum.universal-robots.com/u/marvin.kaphengst)\
**Post date:** [August 29, 2018, 7:23am UTC](https://forum.universal-robots.com/t/continuous-if-statement-in-ur-script/2565/6 "2018-08-29T07:23:40Z")

</div>

Yes, I figured it out and got everything working. Thanks for the help.
