while — While loop.

while condition body

while

condition

body

The while command continues to evaluate body while condition is true.

set i 0 while { < $i 6 } { puts "i is $i" incr $i }

Produces:

i is 0 i is 1 i is 2 i is 3 i is 4 i is 5