Sample
|
Example -1 Break <HTML> <BODY> <CARAVAN>loop ctr (100) "The value of the counter is " ctr(counter) "<br>" if ctr(counter) = "50" break repeat ctr 101 </CARAVAN> </BODY> </HTML>
Loop statements in Caravan can be nested to any number of levels .
End value of the loop statement can be replaced with a variable. But the end value of a repeat statement has to be a constant. Loops can be used to display array values and record sets directly. Example - 2 Counter <HTML> <BODY> <CARAVAN> vartemp temp(delim)="," temp(name)="John,Mary,Chris" loop ctr (temp(name(00))) ctr(counter);") ";temp(name(ctr(count)));"<br>" repeat ctr 100 </CARAVAN> </BODY> </HTML> Example -3 Count <HTML> <BODY> <CARAVAN> var temp temp(delim)="," temp(name)="John,Mary,Chris" loop ctr (temp(name(00))) ctr(counter);") ";temp(name(ctr(count)));"<br>" repeat ctr 100 </CARAVAN> </BODY> </HTML>
|