
While Loop

Samucha
✭
in RobotStudio
Hi' All
How to exit while loop and continue next command ?
Example
VAR num sum;
How to exit while loop and continue next command ?
Example
VAR num sum;
PROC testwhile()
WHILE TRUE DO
Incr sum;
IF sum = 10 THEN
TPWrite "Sum :" \Num:= sum;
TPWrite "Sum :" \Num:= sum;
! ---------- Exit while loop and continue command
ENDIF
ENDWHILE
ENDPROC
PROC summ()
testwhile;
TPWrite "Exit loop while";
ENDPROC
Thanks for help.
PROC summ()
testwhile;
TPWrite "Exit loop while";
ENDPROC
Thanks for help.
0
Comments
-
Hello
There is no break command but you could set a condition for the while loop like WHILE NOT sum = 10 THEN
/Pavel0 -
Something like this
VAR num sum;
VAR bool bExit:=FALSE;PROC testwhile()WHILE NOT bExit DOIncr sum;IF sum = 10 THEN
TPWrite "Sum :" \Num:= sum;
bExit:=TRUE;! ---------- Exit while loop and continue commandENDIFENDWHILEENDPROC
PROC summ()
testwhile;
TPWrite "Exit loop while";
ENDPROCPer Svensson
Robotics and Vision Specialist
Consat Engineering0 -
Hi,All
Thanks for help.0
Categories
- All Categories
- 5.4K RobotStudio
- 379 UpFeed
- 15 Tutorials
- 12 RobotApps
- 286 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 241 ScreenMaker
- 2.7K Robot Controller
- 272 IRC5
- 41 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 731 RAPID Programming
- 15 Wizard Easy Programming
- 108 Collaborative Robots
- 3 Job listings