Microsoft KB Archive/43901

= Multiple CASE ELSE Allowed in QB.EXE; Causes Compile Errors =

Article ID: 43901

Article Last Modified on 11/21/2006



This article was previously published under Q43901



SYMPTOMS
The SELECT CASE statement allows multiple occurrences of the same CASE condition. Because a SELECT CASE statement operates in sequential order, the first instance of any CASE is always taken. If there are other CASE conditions listed after the CASE ELSE statement, these may cause the compiler errors &quot;SELECT without END SELECT&quot; and &quot;END SELECT without SELECT.&quot;



STATUS
Microsoft has confirmed this to be a bug in QuickBasic Versions 4.00, 4.00b, and 4.50, and in the QB.EXE that is shipped with Microsoft Basic Compiler Versions 6.00 and 6.00b (buglist6.00 buglist6.00b). This problem was corrected in Microsoft Basic Professional Development System (PDS) Version 7.00 (fixlist7.00).

Code Example
In the following code example, the QB.EXE environment will not produce an error. During compilation, the error &quot;SELECT without END SELECT&quot; occurs on the second CASE ELSE and the error &quot;END SELECT without SELECT&quot; occurs on the END SELECT.

In the QBX.EXE environment that is shipped with PDS, the second CASE ELSE statement is flagged with the error message &quot;CASE without SELECT.&quot; CLS DO INPUT &quot;&quot;, x SELECT CASE x CASE IS = 1 PRINT &quot;ONE&quot; CASE IS = 2 PRINT &quot;TWO&quot; CASE IS = 3 PRINT &quot;THREE&quot; CASE IS = 3          'This CASE never chosen PRINT &quot;THREE 2&quot; CASE ELSE PRINT &quot;OTHER&quot; CASE ELSE            'This line causes &quot;SELECT without END SELECT&quot; PRINT &quot;OTHER 2&quot; END SELECT             'This line causes &quot;END SELECT without SELECT&quot; LOOP UNTIL x = 0

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom

Keywords: KB43901

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.