KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q65599: SELECT CASE Documentation Error in "Learn BASIC Now", MS Press

Article: Q65599
Product(s): See article
Version(s): 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S900828-7 docerr | mspl13_basic
Last Modified: 20-SEP-1990

In the book "Learn BASIC Now" (Microsoft Press, 1989), an incorrect
example of the SELECT CASE statement is shown on Pages 116 and 117.

Page 116 Example
----------------

The (incorrect) example at the bottom of Page 116 is as follows:

   SELECT CASE userNum%
        CASE IS 1 TO 5
             PRINT "The number you entered was between 1 and 5."
        CASE IS 6 TO 10
             PRINT "The number you entered was between 6 and 10."
   END SELECT

The SELECT CASE example on Page 116 should be corrected to read as
follows:

   SELECT CASE userNum%
        CASE 1 TO 5
             PRINT "The number you entered was between 1 and 5."
        CASE 6 TO 10
             PRINT "The number you entered was between 6 and 10."
   END SELECT

Page 117 Example
----------------

The (incorrect) code example on Page 117 is as follows:

   SELECT CASE word$
        CASE IS "a" TO "m"
             PRINT "The word you entered was in the range a to m."
        CASE IS "m" to "z"
             PRINT "The word you entered was in the range m to z."
   END SELECT

The code example on Page 117 should be corrected to read as follows:

   SELECT CASE word$
        CASE "a" TO "m"
             PRINT "The word you entered was in the range a to m."
        CASE "m" to "z"
             PRINT "The word you entered was in the range m to z."
   END SELECT

The examples on Pages 116 and 117 incorrectly use the IS keyword in
the CASE statement. The IS keyword should only be used when specifying
a relational operator, such as <=, >=, =, or <> in a conditional
expression. For example

   CASE IS <= 5

correctly uses the IS keyword.

SELECT CASE is correctly described in the Online Help system of the
Microsoft QuickBASIC Interpreter (QBI.EXE version 1.00) on the disk
that comes with the "Learn BASIC Now" book.

QBI.EXE version 1.00 has the same language features as QuickBASIC
version 4.50, but note that QBI.EXE is just an interpreter and cannot
create .EXE programs.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.