[Coco] More on FOR-NEXT

Arthur Flexser flexser at fiu.edu
Sun Jun 11 18:57:11 EDT 2006


Unless you are planning to use some code later that depends on the value of A
being 11 (which you really shouldn't), there is no reason to prefer the first
version to the second.  (I'm assuming there's something in the loop code that
would affect P, otherwise it would be much more efficient to put the IF
statement before the loop rather than within it.)

Art

On Sun, 11 Jun 2006, Diego Barizo wrote:

> When forcing an exit from a FOR-NEXT loop, does it make any difference 
> to do a clean exit, by manually changing the variable value and GOTOing 
> to the NEXT line, or is it the same that just GOTO?
> Ex:
> 10 FOR A=1 TO 10
> 20 IF P=3 THEN A=11:GOTO  30
> 30 NEXT A
> 40 REM REST OF THE PROGRAM
> 
>  is any better than
> 
> 10 FOR A=1 TO 10
> 20 IF P=3 THEN 40
> 30 NEXT A
> 40 REM REST OF THE PROGRAM
> 
> Diego
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 




More information about the Coco mailing list