Tcl uses the pound character, #, for comments. Unlike in many other languages, the # must occur at the beginning of a command. A # that occurs elsewhere is not treated specially. An easy trick to append a comment to the end of a command is to precede the # with a semicolon to terminate the previous command:
# Here are some parameters set rate 7.0 ;# The interest rate set months 60 ;# The loan term
One subtle effect to watch for is that a backslash effectively continues a comment line onto the next line of the script. In addition, a semicolon inside a comment is not significant. Only a newline terminates comments:
# Here is the start of a Tcl comment and some more of it; still in the comment
The behavior of a backslash in comments is pretty obscure, but it can be exploited as shown in Example 2-3 on page 27.
A surprising property of Tcl comments is that curly braces inside comments are still counted for the purposes of finding matching brackets. I think the motivation for this mis-feature was to keep the original Tcl parser simpler. However, it means that the following will not work as expected to comment out an alternate version of an if expression:
# if {boolean expression1} { if {boolean expression2} { some commands }
The previous sequence results in an extra left curly brace, and probably a complaint about a missing close brace at the end of your script! A technique I use to comment out large chunks of code is to put the code inside an if block that will never execute:
if {0} { unused code here }
18.218.8.147