.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>quisp: loops</title>
<body bgcolor=99cc99 vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td align=right><a href="quisp_home.html">
<img src="img/quisp2.gif" border=0><br><small>quick server pages</a> &nbsp; &nbsp; </td></tr>
<td>
.>>

.TH loops TDH "16-MAR-2004   TDH scg@jax.org" 

.SH Looping
\fC#while\fR, \fC#for\fR, and basic loops are supported.
All types use \fC#endloop\fR to signify the end of the loop body.
Loops can be nested.

.ig >>
<br><br><br>
.>>

.SH #while
Loop the flow of control while a
.ig >>
<a href="condex.html">
.>>
\0conditional
.ig >>
</a>
.>>
is true.
If the expression is initially false, the loop body will not be executed at all.
.LP
Example: Loops until I exceeds 10:
.LP
.nf
\0#set I = 0
\0#while @I <= 10
\0  #set I = $arith(@I+1)
\0#endloop
.fi

.ig >>
<br><br><br>
.>>

.SH #for .. in ..
Loop the flow of control, iterating across members of a
.ig >>
<a href="commalist.html">
.>>
\0comma-delimited list
.ig >>
</a>
.>>
If the list is empty, the loop body will not be executed.
.LP
Example: suppose \fCmset\fR contains a list.
.nf
\0#for M in @mset
\0  ...
\0#endloop
.fi

.ig >>
<br><br><br>
.>>

.SH #for .. across ..
.LP
Loop the flow of control, iterating across members of
a \fImultirow-response\fR to a <SELECT MULTIPLE> HTML form item.
No leading at-sign should be used on the variable names.
\fIvar\fR will be set to each member from first to last.
If no lines were selected, the loop body will not be executed.
.LP
Example: suppose \fCcategories\fR is the response to a \fC<SELECT MULTIPLE>\fR box.
.nf
\0#for M across categories
\0  ..
\0#endloop
.fi

.ig >>
<br><br><br>
.>>


.SH #loop
.LP
Loop the flow of control.  \fC#break\fR \fBmust\fR be used to terminate the loop.
.LP
Example: Loops until I exceeds 10:
.LP
.nf
\0#set I = 0
\0#loop
\0   #set I = $arith(@I+1)
\0   #if @I > 10
\0       #break
\0   #endif
\0#endloop
.fi

.ig >>
<br><br><br>
.>>

.SH #break
Terminate the iteration of the most recently invoked loop.
Script execution resumes at the statement immediately following
the corresponding \fC#endloop\fR.
There are restrictions if used within an 
.ig >>
<a href="flow.html">
.>>
\0#included
.ig >>
</a>
.>>
file.

.ig >>
<br><br><br>
.>>

.SH #continue
Proceed directly to the next
iteration of the most recently invoked loop.
There are restrictions if used within an 
.ig >>
<a href="flow.html">
.>>
\0#included
.ig >>
</a>
.>>
file.

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="quisp_home.html">
<img src="img/quisp2.gif" border=0></a><br>
<small>quick server pages &nbsp; &nbsp;<br>
<a href="Copyright.html">Copyright Steve Grubb</a> &nbsp; &nbsp;
</td></tr>
</table>
.>>
