开发者

do we have the statement works as if {0} in TCL?

开发者 https://www.devze.com 2023-03-20 01:35 出处:网络
In TCL, I wonder if we have some statements just like if {0} {...}, I mean I do not want to use if {开发者_开发知识库0} {...}, so do we have other alternative?You can create any command you want to wo

In TCL, I wonder if we have some statements just like if {0} {...}, I mean I do not want to use if {开发者_开发知识库0} {...}, so do we have other alternative?


You can create any command you want to work the same way. In the following example I create a command named "-" that accepts arbitrary arguments and does nothing. The only caveat is that you must use balanced quoting:

proc - args return

- {
    this code/data will not execute
}
- neither will this
- "this won't execute either"

Of course, with those last two examples, variable and command substitution may happen, depending on what follows the '-'

0

精彩评论

暂无评论...
验证码 换一张
取 消