qb45advr.hlp (Topic list)
END Statement Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
END Statement Programming Example
 
These examples show how to use END IF and END SELECT forms of the
END statement to terminate IF...THEN...ELSE and SELECT CASE blocks.
 
Here is an example of using END IF with a block IF...THEN...ELSE
for a multiple-choice decision:
 
  INPUT X
  IF X = 1 THEN
    PRINT "one"
  ELSEIF X = 2 THEN
    PRINT "two"
  ELSEIF X = 3 THEN
    PRINT "three"
  ELSE
    PRINT "must be integer from 1-3"
  END IF
 
This example uses the SELECT CASE structure to do the same thing:
 
  INPUT X
  SELECT CASE X
    CASE 1
      PRINT "one"
    CASE 2
      PRINT "two"
    CASE 3
      PRINT "three"
    CASE ELSE
      PRINT "must be integer from 1-3"
  END SELECT