Home
Main Introduction Features Constants Statements Database Objects Parser Serial-Communication Samples Misc
Statements>Nested If-else-endif
Caravan Business Server>Help>Statements>Nested If-else-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>
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.
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.
Back