Tcl语言中的 continue 语句的工作原理与 break 语句类似。但是, continue 不是强制终止,而是强制循环的下一次迭代发生,从而跳过两者之间的任何代码。

continue statement - 语法

Tcl中 continue 语句的语法如下-

continue;

continue statement - 流程图

Continue Statement

continue statement - 示例

#!/usr/bin/tclsh

set a 10
# do循环执行
while { $a < 20 } {
   if { $a == 15} {
      #跳过迭代
      incr a
      continue
   }
   puts "value of a: $a"
   incr a     
}

编译并执行上述代码后,将产生以下输出-

value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 16
value of a: 17
value of a: 18
value of a: 19

参考链接

https://www.learnfk.com/tcl-tk/tcl-continue-statement.html