Select Case
The Select Case statement allows you to evaluate an
expression and perform multiple actions based on the result
of that expression.
The Select Case statement starts a block of code that
ends with the End Case statement. Within this block,
you put as many Case statements as you like. Each
Case statement contains a literal value or list of
literal values (separated by commas) to match.
When the Select Case code is evaluated, the first
matching case is found that matches the expression. That
code is executed and then the Select Case block is
exited.
' display a greeting based on the hour
Select Case Hour(Now()) Case 0, 1, 2, 3, 4, 5 Response.Write "Good Night!" Case 6, 7, 8, 9, 10, 11 Response.Write "Good Morning!" Case 12, 13, 14, 15, 16, 17 Response.Write "Good Afternoon!" Case 18, 19, 20, 21, 22, 23 Response.Write "Good Evening!" End Select
|
 |

|