有人能告诉我为什么 TCL 的第一块不编译而第二块编译吗?
Can someone tell me why the first block of TCL does not compile but second does?
代码如下。 运行 分别来说,最上面的一段没有以任何方式编译,但底部的段编译得很好。
proc printbobs {times {textd "cream corn"}} {
for {set r 0} {$r<$times} {incr r}{
puts $textd
}
return $times
}
printbobs 2
proc printText {times2 {textp "hello word"}} {
for {set i 0} {$i<$times2} {incr i} {
puts $textp
}
return $times2
}
printText 2
在程序的第二行 {incr r}
和 {
之间缺少 space。
代码如下。 运行 分别来说,最上面的一段没有以任何方式编译,但底部的段编译得很好。
proc printbobs {times {textd "cream corn"}} {
for {set r 0} {$r<$times} {incr r}{
puts $textd
}
return $times
}
printbobs 2
proc printText {times2 {textp "hello word"}} {
for {set i 0} {$i<$times2} {incr i} {
puts $textp
}
return $times2
}
printText 2
在程序的第二行 {incr r}
和 {
之间缺少 space。