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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM