.jpg?sfvrsn=3ad09b0a_1)
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
- 10.4K All Categories
- 5.3K RobotStudio
- 346 UpFeed
- 15 Tutorials
- 8 RobotApps
- 281 PowerPacs
- 404 RobotStudio S4
- 1.7K Developer Tools
- 238 ScreenMaker
- 2.6K Robot Controller
- 246 IRC5
- 36 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 691 RAPID Programming
- 14 Wizard Easy Programming
- 101 Collaborative Robots
- 3 Job listings