set l [list a bc def 1 23 456]
set m 0
foreach i $l {
incr m
puts "member $m is $i"
}
for {set x 0} {$x<10} {incr x} {
puts "x is $x"
}
set x 0
while {$x<10} {
puts "x is $x"
incr x
}
This command is typically invoked inside the body of a looping command such as for or foreach or while.
for {set x 0} {$x<10} {incr x} {
if {$x > 5} {
break
}
puts "x is $x"
}