VBScript TutorialIntroductionVBScript Editors VBScript Syntax VBScript Variables VBScript Arrays VBScript Date VBScript If Statements VBScript Select Case VBScript While Loop VBScript For Loop VBScript Operators VBScript Functions Summary Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
VBScript Select CaseIn the previous lesson, we used an Elseif statement to perform multiple checks against the value of a variable. VBScript Select Case statements are a more efficient way of doing this. A Select Case statement allows us to perform multiple tests, with less code (and less computing power). This can be especially beneficial when you have many cases to test for. Example Select Case Statement
This results in:
Same as the canary
Limitations of Select CaseNow, you may be thinking, "if Select Case is so efficient, why use If Elseif at all?". Although the Select Case statement is more efficient than an If Elseif statement for this type of thing, it is somewhat limited - there may be times that you need to use an If Elseif statement. For example, the Select Case statement only allows you to check if a variable is equal to a value - you can't test to see if it is greater than, less than etc. Also, you can only test against one variable. If you have multiple variables to test against, you'll need to use an If statement. Enjoy this website?
Oh, and thank you for supporting Quackit! |
FREE Hosting!With every domain name you register with ZappyHost, you get FREE (ad supported) hosting.PLUS you get:
Featured Template:
(Build your websites in minutes!) |