1# Looping with while
2# While x is less than 11 print out the value of x
3set x 1
4while {$x < 11} {
5    puts "x = $x"
6    incr x
7}
8 
9#x = 1
10#x = 2
11#x = 3
12#x = 4
13#x = 5
14#x = 6
15#x = 7
16#x = 8
17#x = 9
18#x = 10

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading