我在while循环中有一个for循环。我有一个条件来打破for循环中的while。在tcl中打破父循环
下面是代码:
while {[gets $thefile line] >= 0} {
for {set i 1} {$i<$count_table} {incr i} {
if { [regexp "pattern_$i" $line] } {
for {set break_lines 1} {$break_lines<$nb_lines} {incr break_lines} {
if {[gets $thefile line_$break_lines] < 0} break
}
}
#some other process to do
}
我想跳过$nb_lines
解析,以进一步做其他事情的文件中。这里中断,打破了for循环,所以它不起作用。
for循环可以使while循环断开吗? 但突破只是为1(或更多)线,我想继续分析该文件的突破工艺线后进一步
感谢
如果你想知道,0是为正常成功,1是为了一个错误(并导致堆栈跟踪建立在展开期间),2用于从当前程序返回,3用于“break”,4用于“continue”。 – 2012-07-17 20:11:31
好的,谢谢! – heyhey 2012-07-18 12:40:20