SELECT CASE Documentation Error in "Learn Basic Now", MS Press (65599)



The information in this article applies to:

  • Microsoft QuickBASIC 4.5

This article was previously published under Q65599

SUMMARY

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
				

MORE INFORMATION

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.

Modification Type:MinorLast Reviewed:1/9/2003
Keywords:KB65599