Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
equivalent "break" keyword
lets say we have
for i = 1 to 5
if condition then
//I wanna jump to next iteration,
end
...
Next i
for i = 1 to 5
if condition then
//I wanna jump to next iteration,
end
...
Next i
Comments
I offered one solution using a GoTo label (although I'm normally anti-GoTo):
Log = '' a = 1 Loop if a >= 5 AND a <= 6 then a += 1 Goto Continue end Log := 'a = ' : a : @FM a += 1 Continue: Until a = 20 Repeat Log[-1, 1] = ''
Bob Carten offered a solution using the Case statement:
done = false$ loop readnext k begin case case <cond1> done =1 case <cond2> * CONTINUE case otherwise$ < do more stuff> end case until done repeat
for i = 1 to 5 if condition else // do my stuff? end Next i
Oversimplified?
I'll avoid any Gotos, breaks, or even premature Returns within block, like the plaque! (Probably because I was trained way back to deduct marks on student 101 assignments for doing that kind of stuff ;)
for i = 1 to 5 if needToJumpToNextIteration else GoSub do_my_stuff end Next i
I'm not convinced that familiar syntax is a reasonable motive for ignoring good practice. Perhaps that's why the original OI forum post was so lively.