> 100 CLS : INPUT '>';n
> 110 FOR i=0 TO n
> 120    IF i MOD 2=0 THEN NEXT i
> 130    PRINT i
> 140 NEXT i
> 150    PRINT 'done'
> 160 END FOR i
> 
> To get round this in a piece of code I'm currently engaged on, I have had
> to test for i=n when the exception arises and use EXIT i when on the final
> loop. Comments anyone?

I find the adage "If all else fails, read the manual" useful (but I
suspect that you may not have one, so here's the entry for NEXT:

NEXT is used to terminate, or create a loop _epilogue_ in REPeat and FOR
loops

syntax:   NEXT <identifier>

The identifier must match that of the loop which the NEXT is to control

[examples cut]

If NEXT is used onside a REPear - END REPeat contruct it will force
processing to continue at the statement following the matching REPeat
statement.  [Most similar to the C 'continue;' statement]

The NEXT statement can be used to repeat the FOR loop with the control
variable set at its next value.  If the FOR loop is exhausted then
processing will continue at the statement following the NEXT; otherwise
processing will continue at the statement after the FOR.)


Reply via email to