|
Select Case (by John Kauffman &
Charles Carroll)
Using IF-THEN can be cumbersome, prone to programmer errors
and slower to execute. A more efficient construct is SELECT CASE. It is optimized for
testing one variable against many conditions.
filename=/learn/test/case.asp
<html><head>
<TITLE>case.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="caserespond.asp" method="get">
Your First Name<INPUT NAME="FirstName" MaxLength=20><p>
Your Last Name<INPUT NAME="LastName" MaxLength=20><p>
<INPUT TYPE=submit><p><INPUT TYPE=reset>
</form>
</body></html>
Here is the select case that will determine what the form
input means.
filename=/learn/test/caserespond.asp
<html><head>
<TITLE>caserespond.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%
fname=request.querystring("Firstname")
lname=request.querystring("Lastname")
%>
Nice to Meet You <%=fname%> <%=lname%><p>
<%If fname="" then%>
Sorry we are not on a first name basis...<p>
<%end if
select case lcase(lname)
case "washington","adams"
response.write "The first president has same last name<p>"
case "jefferson"
response.write "The third president has same last name<p>"
case "lincoln"
response.write "The sixteenth president has same last name<p>"
end select%>
</body></html>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|