Home Applications

Discussion

Left ArrowBack to discussions page
ElsayedElsayed Posts: 29 Apprentice
Hello Everyone,

I wonder if we have in universal program robot something like Break the loop if a specific condition will  be triggered.

Thanks In Advance,
Elsayed

Best Answer

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,171 Handy
    It does, it's just not how you would normally expect to implement it with a break statement.  When you set up the loop there is a check box on the screen that says check the condition continuously.  What this does is place the loop itself in a thread and then has another thread that monitors the conditions you have set and anytime one of the conditions is no longer satisfied it kills the other thread thereby breaking the loop.  Simply place the condition that you want to break on in the conditional logic statement for the loop and check the box on the loop screen.

    This also works for if statements so that you can break an if statement at any time the condition is no longer satistfied
  • ElsayedElsayed Posts: 29 Apprentice
    Oh really good to know, I will try it tomorrow. Thank you very much for this explanation.
  • ElsayedElsayed Posts: 29 Apprentice
    Please Matthew,

    I was trying to check the loop options so I found I have to select [ loop as long as the following expression is true ]
    but as I understand the loop instruction will only check this condition at the beginning of the loop cycle.
    but I want to break the loop in the middle of the loop cycle according to another condition status.

    I hope my explanation is clear.

    Thanks,
    Elsayed




  • ElsayedElsayed Posts: 29 Apprentice
    Thank you very much 
Sign In or Register to comment.
Left ArrowBack to discussions page