1mNAME0m
       while - Execute script repeatedly as long as a condition is met

1mSYNOPSIS0m
       1mwhile 4m22mtest24m 4mbody0m


1mDESCRIPTION0m
       The 1mwhile 22mcommand evaluates 4mtest24m as an expression (in the same way that
       1mexpr 22mevaluates its argument).  The  value  of  the  expression  must  a
       proper  boolean  value;  if it is a true value then 4mbody24m is executed by
       passing it to the Tcl interpreter.  Once 4mbody24m has  been  executed  then
       4mtest24m  is evaluated again, and the process repeats until eventually 4mtest0m
       evaluates to a false boolean value.  1mContinue 22mcommands may be  executed
       inside  4mbody24m  to terminate the current iteration of the loop, and 1mbreak0m
       commands may be executed inside 4mbody24m to cause immediate termination  of
       the 1mwhile 22mcommand.  The 1mwhile 22mcommand always returns an empty string.

       Note:  4mtest24m  should almost always be enclosed in braces.  If not, vari-
       able substitutions will be made before the 1mwhile 22mcommand starts execut-
       ing,  which  means that variable changes made by the loop body will not
       be considered in the expression.  This is likely to result in an  infi-
       nite  loop.   If 4mtest24m is enclosed in braces, variable substitutions are
       delayed until the expression is evaluated (before each loop iteration),
       so  changes  in the variables will be visible.  For an example, try the
       following script with and without the braces around 1m$x<1022m:
              set x 0
              while {$x<10} {
                puts "x is $x"
                incr x
              }


1mSEE ALSO0m
       break(n), continue(n), for(n), foreach(n)


1mKEYWORDS0m
