我在 TCL 编程方面相当新,通过阅读基础知识,我遇到了以下代码片段:
set x 0;
while "$x < 3" {
set x [expr $x + 1]
if {$x >6} break;
if "$x > 2" continue;
puts "x is $x";
}
puts "exited second loop with X equal to $x\n"
执行时,结果如下:
x is 1
x is 2
退出第二个循环,X 等于 7
令我惊讶的是,当执行 continue 命令时,似乎没有评估 while 循环测试 (x<3)。然而,在 tcl 手册页中声明“正文中的 continue 语句将停止代码的执行,并且将重新评估测试。 ”
我错过了什么?