首页 > 其他 > 详细

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

时间:2016-08-03 00:08:00      阅读:749      评论:0      收藏:0      [点我收藏+]

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用法

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

原文:http://www.cnblogs.com/gold-life/p/5731135.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!