Article ID: 35666
Article Last Modified on 11/21/2006
This article was previously published under Q35666
SYMPTOMS
In the QB.EXE editor, when a NEXT statement is inserted inside a nested FOR NEXT loop after a "FOR WITHOUT NEXT" error has occurred, loop control is incorrectly executed.
STATUS
Microsoft has confirmed this to be a bug in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, and in the QB.EXE that comes with the Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b). This problem was corrected in the Microsoft Basic PDS Version 7.00 (fixlist7.00).
MORE INFORMATION
To duplicate this problem, do the following:
Enter the following code in the QuickBasic editor:
CLS FOR k = 1 to 5 FOR l = 1 to 2 PRINT k NEXT
Running this will give the FOR WITHOUT NEXT error.
Insert another NEXT statement after the "PRINT k" and run the program again.
The output should be as follows:1 1 2 2 3 3 4 4 5 5
However, it is as follows:
1 1 2 2
If the NEXT is inserted after the already existing NEXT, the program runs correctly.
Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom
Keywords: KB35666