|
Post by tsh73 on Mar 20, 2021 13:17:35 GMT -5
If I understand what you saying then alas no Jumping out of loops with GOTO not safe in current version of LB, be it FOR or WHILE.
There is special statements for SAFELY jumping out EXIT FOR EXIT WHILE EXIT DO
Again, I might as well not understand what you mean.
|
|
|
Post by Rod on Mar 20, 2021 13:27:57 GMT -5
While Wend will exit correctly if the While test fails. So yes you are getting to grips with it. Tsh73 is ensuring that you understand that it is not correct to jump out of While Wend at any other point.
|
|
|
Post by Carl Gundel on Mar 20, 2021 14:54:53 GMT -5
While Wend will exit correctly if the While test fails. So yes you are getting to grips with it. Tsh73 is ensuring that you understand that it is not correct to jump out of While Wend at any other point. You can of course jump out of a FOR/NEXT loop using this technique, which sets y to the FOR/NEXT loops terminating value and then uses GOTO to skip to the next y statement. for x = 1 to 10 print "x = "; x for y = 1 to 10 r = int(rnd(1)*10)+1 if r > 9 then print "skip to end of y" ; : y = 10 : goto [skip] print r; " "; [skip] next y print next x print "Done."
|
|