发表评论
Tcl 中的注释最好被认为是另一个命令。
注释包含 #
,后跟任意数量的字符,直到下一个换行符。可以在可以放置命令的任何位置显示注释。
# this is a valid comment
proc hello { } {
# the next comment needs the ; before it to indicate a new command is
# being started.
puts "hello world" ; # this is valid
puts "dlrow olleh" # this is not a valid comment
# the comment below appears in the middle of a string.
# is is not valid.
set hw {
hello ; # this is not a valid comment
world
}
gets stdin inputfromuser
switch inputfromuser {
# this is not a valid comment.
# switch expects a word to be here.
go {
# this is valid. The switch on 'go' contains a list of commands
hello
}
stop {
exit
}
}
}