Section 3.5
Programming In QuickBASIC
3.5 Selection
Selection is a fundamental building block of a structured language.
3.5.1 IF - END IF Structures
The IF - END IF structure is a decision structure that allows different courses of
action to occur.
IF <condition> THEN
   - - -
ELSEIF
   - - -
ELSE
   - - -
END IF
The SELECT CASE
structure is an alternative to IF - END IF
.
It is preferable to use when there is a large number of alternative actions.
SELECT CASE <variable>
   CASE IS <condition>
   CASE <value>
   CASE <min> TO <max>
   CASE ELSE
END SELECT
- All
CASE
statements refer to the variable on the top line.
CASE
arguments can be a list of values separated by commas.
- Ranges can be used where to values are separated by
TO
.
CASE
statements can be followed by an relational operator.
CASE ELSE
is an optional "catch all" if any other CASE
statements are not executed.
- Only 1
CASE
statement can be executed.