#95 While loop in tcl
set x 1 # This is a normal way to write a tcl while loop. while {$x < 5} { puts "x is $x" set x [expr {$x + 1}] } puts "exited first loop with x equal to $x\n"
Output:
x is 1 x is 2 x is 3 x is 4 exited first loop with x equal to 5
Recent Comments