ASP Select - Case Structure
Select and Case Structure in ASP
As mentioned in the lesson text, the
Select/Case structure can contain as many Case tests as needed. All comparison operators can be used. The colon at the end of each
Case statement is optional.
Here is the syntax:
Select Case variable
One use of this structure in our T-shirt store might be to set the value of a character variable to the spelled-out shirt size based upon a one-letter code input by the user.
Here is a code segment that accomplishes this:
<% 'BEGIN ASP SCRIPT
Select Case cSizeAbbrev
cSizeFull = "Small"
cSizeFull = "Medium"
cSizeFull = "Large"
cSizeFull = "Extra-Large"
cSizeFull = "Unknown"
<!–END ASP SCRIPT ––>
This spelled-out text in the variable can be used later to print a receipt or display a message to the user.