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
%>