Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











STATEMENT:  If  ...  Then  ...  Else

Implemented in version 1.0
 
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
%>


 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information