Tcl中的注释行是以字符'#'开头的。如果是和命令写在同一行,则需要写在分号';'之后。否则不会被当作注释。
puts hello ;# comment line puts hello # comment
上面第一行命令是正确的写法,每二行则是不正确的写法。
# this is a multiple comment line \ comment line2 # comment line { ... }
上面每一个多行注释是对的,行尾的反斜线的用法和跨行命令的用法是一样的。这使得"#"的表现就像是一个命令。
但每二个“多行注释”却是不对的。行尾的大括号并没有像命令中的大括号一样实现跨行
if 0 { this is comment block }
看起来有些不像注释,但确实能用。
proc /* {args} {} proc // {args} {} proc -- {args} {} proc {#} {args} {} /* this is comment line , for multiple line comment, like this { comment line 2 } */ // this is a comment line too. {multiple line comment comment line 2 } -- {comment block } {#} {comment block }