What is the function and syntax of SELECT CASE statement? (Qbasic)

SELECT CASE –
  • Select Case executes one of several statements blocks depending on the value of expression.
Syntax:
    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

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.