發表評論

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
     }
  }
}