ASP Select Case syntax and select cases

Source: Internet
Author: User
Tags expression

Select the work of the report, if the statement. The difference, however, is that they can check for multiple values. Of course, you have

Many of the same, if. Else statement, but this is not always the best method.

The SELECT statement allows a program to evaluate the expression and attempt to match the value of the expression to the case label. If you find a horse

With, the program executes the related declaration. The syntax for the SELECT statement is as follows:
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 with the value tag of the matching expression, and then the control shifts to the clause, performing the phase

Off the statement. If no matching tag is found, the program looks for the optional ELSE clause and, if found, controls

Transfer to the clause and execute the relevant statement. If no case Else clause is found, the declaration that the program continues to execute

End after selection. Use the rest time to avoid automatic execution by entering the next code.

Let's consider an example:
<%@ language= "VBScript" >
<%
Dim Flower
Flower = "Rose"

Select Case Flower
  case "Rose"
     Response.Write (Flower & "costs $2.50")
  Case "Daisy"
     Response.Write (Flower & "costs $1.25")
  case "Orchild"      Response.Write (Flower & "costs $1.50")
  Case Else
     ; Response.Write ("There is no such flower into our own shop")
End Select
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.