When we make choice judgment, we usually use the IfElse method, but it is not suitable when the condition of judgment is more.
We usually use Select Case method to make choice judgment.
The SELECT statement allows a program to evaluate the expression and attempt to match the value of the expression to the case label.
If a match is found, the program executes the relevant declaration. The syntax for the SELECT statement is as follows:
The code is as follows |
Copy Code |
<% Select Case Expression Case Label_1 Statements_1 Case Label_2 Statements_2 ... Case Else Statements_n End Select %> |
The plan first looks for the case of the value tag of the matching expression, and then the control shifts to the clause to execute the declaration of phase
. If a matching tag is not found, the program looks for the optional ELSE clause and, if found, controls the
transfer to the clause and executes the relevant declaration. If no case Else clause is found, the program continues to execute the declaration
after the selection ends. Use the rest time to avoid automatic execution by entering the next code.
Let's consider an example:
code is as follows |
copy code |
<% Dim Flower Flower = "Rose" Select Case Flower case "Rose" Response.Write ( Flower & "Costs $2.50") case "Daisy" Response.Write (Flower & "costs $1.2 5 ") case" Orchild " Response.Write (Flower &" costs $1.50 ") case El Se Response.Write ("There is no such flower in my Own shop") End Select %> |