Select...Case敘述

'SELECT...CASE statements
'   This command is more advanced than the IF...THEN...ELSE structures.
'   Depending on the value of the expression, the Select command will execute one of the several
'   groups of statements(or CASE). The general form of this type of statement is
'   Select Case [variable]
'       Case 1
'       [statements]
'       Case 2
'       [statements]
'       Case [N]
'       [statements]
'   End Select

   
Sub Main()

   
Dim x As Byte
   
Do
   
Debugin "Enter a number 1 to 7 to find the nth day of a week.", x, CR   'Select each case base
                                                                            'on the input.
    Select Case x
       
Case 1
           
Debug "It's Sunday.", CR
       
Case 2
           
Debug "It's Monday.", CR
       
Case 3
           
Debug "It's Tuesday.", CR
       
Case 4
           
Debug "It's Wednesday.", CR
       
Case 5
           
Debug "It's Thursday.", CR
       
Case 6
           
Debug "It's Friday.", CR
       
Case 7
           
Debug "It's Saturday.", CR
   
End Select
   
Loop                   
End Sub