Looping with for
The for
command performs the actions desired as long as the condition is met. In this manner the condition is repeatedly evaluated and the actions are performed as long as the condition remains true. The syntax of the for
statement consists of three arguments (start, test
, and next
) and a body:
for start test next body
The start, next
, and the body arguments must be in the form of Tcl command strings with test
as an expression string. The for
command invokes the interpreter to execute start
. Then, it repeatedly evaluates test
as an expression. While the result is non-zero, it invokes the Tcl interpreter on body. Then, it invokes the interpreter on next
and repeats the loop. The command terminates when test
is evaluated to 0. ...
Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.