quick server pages
   
Manual page for loops(TDH)

Looping

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


#while

Loop the flow of control while a conditional is true. If the expression is initially false, the loop body will not be executed at all.

Example: Loops until I exceeds 10:

 #set I = 0
 #while @I <= 10
   #set I = $arith(@I+1)
 #endloop



#for .. in ..

Loop the flow of control, iterating across members of a comma-delimited list If the list is empty, the loop body will not be executed.

Example: suppose mset contains a list.

 #for M in @mset
   ...
 #endloop



#for .. across ..

Loop the flow of control, iterating across members of a multirow-response to a <SELECT MULTIPLE> HTML form item. No leading at-sign should be used on the variable names. var will be set to each member from first to last. If no lines were selected, the loop body will not be executed.

Example: suppose categories is the response to a <SELECT MULTIPLE> box.

 #for M across categories
   ..
 #endloop



#loop

Loop the flow of control. #break must be used to terminate the loop.

Example: Loops until I exceeds 10:

 #set I = 0
 #loop
    #set I = $arith(@I+1)
    #if @I > 10
        #break
    #endif
 #endloop



#break

Terminate the iteration of the most recently invoked loop. Script execution resumes at the statement immediately following the corresponding #endloop. There are restrictions if used within an #included file.


#continue

Proceed directly to the next iteration of the most recently invoked loop. There are restrictions if used within an #included file.


quick server pages    
Copyright Steve Grubb    


Markup created by unroff 1.0,    March 16, 2004.