Introduction Installation Beginning Admin Quick Ref FTP Server SMTP Server Database Security
Statements Objects String Parsing Events Queues Samples Special names Error Handling Accessories   Back
Statements>If-Else-Endif>Properties>Nested If Else Endif
Caravan Business Server>Help>Statements>If-Else-Endif> Properties Nested If Else Endif
Name Nested If Else Endif
Text The if-else-endif statement can be nested within one another. Care must be taken that each if is ended with a corresponding endif.
Syntax

<CARAVAN>
if  <condition>
...
Any number of HTML//Caravan statements can be included
...
else
      if  <condition>
      ...
      Any number of HTML//Caravan statements can be included
      ...
      endif
endif
</CARAVAN>

Sample
Example
<HTML>
<BODY>
<CARAVAN>
var temp
temp(val)="1"
if temp(val)="1"
         "True :  You can place any code you desire here <br>"
else
      "False : You can place any code you desire here<br>"
Endif
</CARAVAN>
</BODY>
</HTML>

Example 2
<HTML>
<BODY>
<CARAVAN>
var temp
temp(val)="1"
if temp(val)="1"
         "condition 1 :  You can place any code you desire here <br>"
elseif temp(val)>"1"
      "Condition 2 : You can place any code you desire here<br>"
      if temp(val)="2"
            "Condition 3 : You can place any code you desire here<br>"
      endif
endif
</CARAVAN>
</BODY>
</HTML>
Control structures in Caravan can be nested to as many levels you want.
Home       Back