tcl脚本学习九:for循环的学习

lesson9 :for循环的学习

 

for {puts "Start"; set i 0} {$i < 2} {incr i; puts "I after incr: $i"; } {
puts "I inside first loop: $i"
}

//和c一样 有三个条件

;# Because the test is evaluated before the body,
;# this loop won't execute the body of the code.

for {puts "Start"; set i 3} {$i < 2} {incr i; puts "I after incr: $i"; } {
puts "I inside second loop: $i"
}
//不符合条件 直接结束For循环

;# A while loop equivalent to the first for loop:

puts "Start"; set i 0;
while {$i < 2} {
puts "I inside first loop: $i"
incr i;
puts "I after incr: $i";
}

//while 中的 incr用法

posted @ 2016-08-02 23:11  用不着为这点小事烦恼  阅读(4276)  评论(0编辑  收藏  举报