ASP Select Case statement syntax and example tutorial

Source: Internet
Author: User
Tags case statement

Select Case is a condition to choose his advantage is the only export, a lot of time he is much better than if else oh.
<script language= "VBScript" runat= "Server" >
Sub Select1 ()
Dim Varweek ' Declare variable
Varweek=weekday (now ()) ' Get an integer representing the day of the week
Response.Write ("<center>") ' Middle display
Font size displayed by Response.Write ("<font size=10>")
Select Case Varweek ' Select Case Conditional selection statement
Case 1 ' Varweek has a value of 1
Response.Write ("Today Sunday")
Case 2 ' Varweek has a value of 1
Response.Write ("Today Monday")
Case 3 ' Varweek has a value of 2
Response.Write ("Today Tuesday")
Case 4 ' Varweek has a value of 3
Response.Write ("Today Wednesday")
Case 5 ' Varweek has a value of 4
Response.Write ("Today Thursday")
Case 6 ' Varweek has a value of 5
Response.Write ("Today Friday")
Case 7 ' Varweek has a value of 6
Response.Write ("Today Saturday")
End Select ' Select Case statement closing flag
Response.Write ("</font>")
End Sub
</script>
<title>example18</title>
<body>
<%
Select1
%>
</body>


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

For more details please see: http://www.111cn.net/asp/2/0ad10f01d7e31bbfce58e3700b98c897.htm

<%
Sub Getstar (Hybuycount)
Select Case Hybuycount
Case 1
Response.Write "Case 3
Response.Write "Case 5
Response.Write "Case 10
Response.Write "Case 20
Response.Write "Case Else
Response.Write "End Select
End Sub
%>

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.