for(n) Tcl Built-In Commands for(n) _________________________________________________________________ NAME for - ``For'' loop SYNOPSIS for _s_t_a_r_t _t_e_s_t _n_e_x_t _b_o_d_y _________________________________________________________________ DESCRIPTION For is a looping command, similar in structure to the C for statement. The _s_t_a_r_t, _n_e_x_t, and _b_o_d_y arguments must be Tcl command strings, and _t_e_s_t is an expression string. The for command first invokes the Tcl interpreter to execute _s_t_a_r_t. Then it repeatedly evaluates _t_e_s_t as an expression; if the result is non-zero it invokes the Tcl interpreter on _b_o_d_y, then invokes the Tcl interpreter on _n_e_x_t, then repeats the loop. The command terminates when _t_e_s_t evaluates to 0. If a continue command is invoked within _b_o_d_y then any remaining commands in the current execution of _b_o_d_y are skipped; pro- cessing continues by invoking the Tcl interpreter on _n_e_x_t, then evaluating _t_e_s_t, and so on. If a break command is invoked within _b_o_d_y or _n_e_x_t, then the for command will return immediately. The operation of break and continue are similar to the corresponding statements in C. For returns an empty string. KEYWORDS for, iteration, looping Tcl Last change: 1