Name

loop

loop var first limit [increment] body

Loop construct in which the beginning and ending loop index variables and increment are fixed. The loop index is variable var, which is initialized to first. In each iteration of the loop, if the index is not equal to limit, the command body is evaluated and the index is increased by the value increment.

Example

# count from ten down to one
    loop i 10 0 −1 {
        echo $i
    }

Get Tcl/Tk in a Nutshell 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.