SELECT CASE –
SELECT CASE expression
CASE exp 1
statement 1
CASE 2
statement 2
CASE n
statement n
CASE ELSE
statement
END SELECT
Example:
CLS
INPUT “Enter your choice (1 – 3)”; N
SELECT CASE N
CASE 1
PRINT “Sunday”
CASE 2
PRINT “Monday”
CASE 3
PRINT “Tuesday”
CASE ELSE
PRINT “No data”
END SELECT
END
- Select Case executes one of several statements blocks depending on the value of expression.
SELECT CASE expression
CASE exp 1
statement 1
CASE 2
statement 2
CASE n
statement n
CASE ELSE
statement
END SELECT
Example:
CLS
INPUT “Enter your choice (1 – 3)”; N
SELECT CASE N
CASE 1
PRINT “Sunday”
CASE 2
PRINT “Monday”
CASE 3
PRINT “Tuesday”
CASE ELSE
PRINT “No data”
END SELECT
END