STATEMENT: SELECT CASE
SELECT CASE
The SELECT CASE conditional statement selectively executes different
groups of code by comparing a variable to a series of conditions.
If there is a match, then the CASE is skipped over and the next
CASE is considered, and so on for each CASE.
You must end the SELECT CASE statement with END SELECT or you will
get an error message.
Code:
<%
SELECT CASE finalnumber
CASE 1
result = "The result is
1"
CASE 2
result = "The result is 2"
CASE 3
result = "The result is 3"
END
SELECT %>
The CASE ELSE statement is optional and will only execute
if none of the other conditions match.
Code:
<%
SELECT CASE firstname
CASE
"Brenn"
Welcome =
"Hello Brenn"
CASE
"Fred"
Welcome =
"Hello Fred"
CASE
"Susan"
Welcome =
"Hello Susan"
CASE ELSE
Welcome = "Hello world"
END SELECT %>
Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information