How to break out of WHILE ?
pollux
✭
in RobotStudio
Comments
-
You break out of while when the conditions on top are not met0
-
Hi pavpav,Thanks I thought so but will hoping RAPID supported a C-ish `break`. But if that's not possible I'll add it to the while condition.p.0
-
The closest I can think of is the RETURN statement that will exit the current routine. That might work if you put your WHILE statement in a dedicated routine.
Henrik Berlin
ABB0 -
Hey Pollux,You can also use the GOTO statement like this:MODULE WhileLoopVAR num count := 0;PROC TestWhileloop()WHILE TRUE DOIF count > 5 THENGOTO nextPart;ENDIFIncr count;ENDWHILEnextPart:TPWrite "Out of while loop";Stop;ENDPROCENDMODULEhope it helps,LarsLars Glud
Danrob A/S0 -
Ah thanks guys for all the possible solutions!0
-
But then this would do the same with less code and without the use of GOTO which I ware thought never to use when I started programming ABB robots.
MODULE WhileLoopVAR num count := 0;PROC TestWhileloop()WHILE count <= 5 DOIncr count;ENDWHILETPWrite "Out of while loop";Stop;ENDPROCENDMODULEBest regards
Alexander Källberg0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings