tcl Tcl Language Constructs Placing Comments


Comments in Tcl are best thought of as another command.
A comment consists of a # followed by any number of characters up to the next newline. A comment can appear wherever a command can be placed.

# 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 

  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
     stop {