DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

foreach(TCL)


foreach -- iterate over all elements in a list

Syntax

foreach varname list body

Description

In this command varname is the name of a variable, list is a list of values to assign to varname, and body is a Tcl script. For each element of list (in order from left to right), foreach assigns the contents of the field to varname as if the lindex command had been used to extract the field, then calls the Tcl interpreter to execute body. The break and continue statements may be invoked inside body, with the same effect as in the for command. The command returns an empty string.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003