Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ASP Best Practices

Next Topic

Select Case Statement

For readability and efficiency, use the Select Case statement in place of IfElse in order to repeatedly check for the same variable for different values. For example:

<%
  Select Case intYrsService
    Case 0 to 5
      strMessage = "You have ten days paid leave this year."
    Case 6 to 15
      strMessage = "You have fifteen days paid leave this year."
    Case 16 to 30
      strMessage = "You have twenty days paid leave this year."
    Case 31 to 100
      strMessage = "Will you never leave?"
  End Select
%>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.