1# Looping with for
2# While x is less than 11 print out the value of x
3for {set x 1} {$x < 11} {incr x} {
4puts "x = $x"
5}
6 
7#x = 1
8#x = 2
9#x = 3
10#x = 4
11#x = 5
12#x = 6
13#x = 7
14#x = 8
15#x = 9
16#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