News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

ASP - Else If Conditional Statement

Started by sajiv, Sep 02, 2008, 02:43 PM

Previous topic - Next topic

sajiv


Whenever at a time you will want to check for multiple conditions but with a normal If Statement you can only check one condition,

You can do this with ElseIf in ASP, which is the name given to an If Statement that depends on another If Statement.

Think about it in plain english: If some condition is true Then do this ElseIf second condition is true Then do this, etc.

In other programming languages,you may have used the ElseIf condition statement , but if not just know that you cannot have an ElseIf statement without first having an if statement.
Below is an example in which second if statement (elseif) is always true.

ASP Code:

    <%
    Dim myFastfood
    myFastfood = "JBox"
    If myFastfood = "McD's" Then
    Response.Write("Happy Meal Por Favor!")
    ElseIf myFastfood = "JBox" Then
    Response.Write("Two tacos please!")
    Else
    Response.Write("Foot-long turkey sub.")
    End If
    %>


O/P:Two tacos please!

:acumen