[Coco] Bug in FOR NEXT ?

Gene Heskett gene.heskett at verizon.net
Wed May 31 23:59:51 EDT 2006


Diego Barizo wrote:
> I have a line like this:
> 1060 FOR A=1 TO 72:PRINT A:IF A$=B$ THEN GOSUB 2000: GOTO 1050  ELSE NEXT A
> 1070 PRINT A
> 
> The routine in line 2000 does not use  the variable A, and as expected, 
> the first PRINT A gives me 1 to 72
> BUT... The line 1070 gives me a value of 73.
> I'm clueless about this. Any ideas?
> 
> Diego
> 
Totally normal Diego.  Think about the else next a above.  It increments 
a, then tests it according to the 1 to 72 criteria, finds its 73, so the 
loop is terminated and it then falls through to 1070 where a is indeed 73.

-- 
Cheers, Gene




More information about the Coco mailing list