![]() | |||||||||||||||||||||
![]() |
|
|
Make a Statement!
Now that we have gone over the common loops found in ASP we need to talk about a couple of other useful statements. Select-Case Statement First of, the Select-Case statement is a very effective means of executing statements based on the value of a given variable.
JobType="Programmer"
Select Case JobType
Select "GraphicsDesigner"
Response.write("I am a Graphics Designer")
Select "NetworkEngineer"
Response.write("I am a Network Engineer")
Select "Programmer"
Response.write("I am a Programmer")
End Select
In this example the statement "I am a Programmer" would be outputted to the page. A "Case Else" statement can be added so if the condition is not met a selected set of statements are then executed. The Select-Case statement is useful for a greater degree of control, ease of use, and ease of reading than several If-Then-Else statements. With Statement The With statement enables several statements to be performed on an object without the object being requalified everytime. With ColorScheme .Trim="Green" .MainColor="Red" .PinStrips="Yellow" End With
Nesting Statements All the previous loops and statements have the ability to be nested within each other and within themselves. For instance: If x=y then do until x=8 x=x+1 loop End If In this instance if "x" is equal to "y" a Do-Until Loop is executed until "x" is equal to "8".
|
Section 2: Loop-the-Loop Section 3: Make a Statement Section 4: Final Results
| ||||||||||||||||||||||