can I jump outside from WHILE loop by using GOTO

  • while a==true
    LIN P7
    LIP P8
    subprogram11()
    GOTO orange
    ENDWHILE
    .
    .
    .
    orange:
    LIN P9
    .
    .
    If I am using a GOTO inside a while will it jump outside the while loop and carry on with the mail program or
    should I use this


    while a==true
    LIN P7
    LIP P8
    subprogram11()
    a==FALSE
    GOTO orange
    ENDWHILE


    ????????????

  • I don't recall ever trying this, but I suspect it would cause the program to crash.


    What confuses me is why you would even do this. The way you have your example constructed, even if it works, there's no point in using a WHILE loop in the first place.


    Possibly you want a REPEAT loop rather than a WHILE loop. The WHILE loop is a "rejecting" loop, with the conditional test at the beginning, while the REPEAT loop puts its test at the end and so always runs at least once.

  • I would like to check my condition first and then do the following, So am using WHILE loop. If the condtion is TRUE then I need the loop to be run only once. and then I need to skip some commands in my main programe and continue, So am giving GOTO.


    So how am skipping out from the loop after one execution of the loop and jumping some commands in main program.


    Do anyone has some other idea????????????

  • Or is this better?


    IF condition THEN
    .
    .
    .
    GOTO orange
    ENDIF


    .
    .
    .
    orange:
    .
    .
    .
    .
    So if the condition is true it will execute once and it will jump to orange


    Is this better and will it work????????????
    Currently mz KUKA robot is on its way for delevery, So I am unable to simulate in real time and I dont have a offline simulator. That's why am asking.
    Thank You

  • just tried loop and jump out using GOTO rather than EXIT (gets out of ONE loop) or RETURN (gets out of sub or program) and it works.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Why not?


    while a==true
    LIN P7
    LIP P8
    subprogram11()
    a=FALSE
    ENDWHILE
    IF a==FALSE THEN
    Insert
    Here
    The
    Code
    To
    Skip
    .
    .
    ENDIF
    ;orange:
    LIN P9



    ????????????????????????

Advertising from our partners