PDA

View Full Version : Select Case


admin
05-30-2003, 07:33 AM
Select Case is an alternative to using multiple If/Else statements. Actually, Select Case is preferred to If/Else statements when it comes to larger code. Plus it's more readable.

Here's an example of using the Select Case statement...

RANDOMIZE
Choice = INT(4+1)*RND)
'will return a random number between 0 and 4.

SELECT CASE Choice
CASE 0
Response.Redirect "http://www.aspsites.com"
CASE 1
Response.Redirect "http://www.refsnesdata.no"
CASE 2
Response.Redirect "http://www.aspin.com"
CASE 3
Response.Redirect "http://www.tcp-ip.com"
CASE 4
Response.Redirect "http://www.actionjackson.com"
END SELECT