tcl Tcl Language Constructs Braces in comments


Example

Due to the way the Tcl language parser works, braces in the code must be properly matched. This includes the braces in comments.

proc hw {} { 
   # this { code will fail
   puts {hello world}
}

A missing close-brace: possible unbalanced brace in comment error will be thrown.

proc hw {} {
  # this { comment } has matching braces.
  puts {hello world}
}

This will work as the braces are paired up properly.