Forum Migration Notice
Update (2026-01-21): The user forums are now in read-only mode pending the data migration.
Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
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.7K RobotStudio
- 402 UpFeed
- 21 Tutorials
- 16 RobotApps
- 307 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 251 ScreenMaker
- 2.9K Robot Controller
- 368 IRC5
- 92 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 859 RAPID Programming
- 43 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings