STATEMENT: If  ... Then  ... Else
If . . . Then
The If conditional statement executes groups of statements only when
a single test condition is True.
You can place If statements inside of other conditional statements.
You must end all If statements with End If or you will get an error message.
Also, the Then must be on the same line as the If.
Code:
<%
If mydate = "6/26/1943" Then
Rem You can place any code you desire here
End If
%>
Code:
<%
If somenumber < 71 Then
Rem You can place any code you desire here
End If
%>
If . . . Then
. . . Else
The If part of the If ... Else statement conditionally executes groups of
statements only when a single test condition is True.
The Else part of the If ... Else statement conditionally executes groups of
statements only when the test If condition is False.
You can place If ... Else statements inside of other conditional statements.
You must end all If ...Else statements with End If or you will get an error message.
Also, the Then must be on the same line as the If.
Code:
<%
If somenumber < 71 Then
Rem You can place any code you desire here
Else
Rem You can place any code you desire here
End If
%>
If . . . Then
. . . ElseIf
The If ... ElseIf statements allows you to test multiple conditions.
The If part of the If ... ElseIf statement conditionally executes groups of
statements only when the test condition is True.
The ElseIf part of the If ... ElseIf statement conditionally executes groups of
statements only when the test If condition is False and the test condition
for that specific ElseIf part is True.
You can place If ... ElseIf statements inside of other conditional statements.
You must end all If ...ElseIf statements with End If or you will get an error message.
Also, the Then must be on the same lines as the If and the ElseIf.
Code:
<%
If somenumber < 43 Then
Rem You can place any code you desire here
ElseIf somenumber < 77 Then
Rem You can place any code you desire here
ElseIf somenumber < 94 Then
Rem You can place any code you desire here
End If
%>
Code:
<%
If somenumber < 43 Then
Rem You can place any code you desire here
ElseIf somenumber < 77 Then
Rem You can place any code you desire here
ElseIf somenumber < 94 Then
Rem You can place any code you desire here
Else
Rem You can place any code you desire here
End If
%>