Tcl syntax

Tcl scripts are nothing more than plaintext files saved with 16-bit Unicode encoding. Such a script consists of one or more commands that are executed by the interpreter at runtime.

Each line of the script (with exceptions described as follows) consists of the command and zero or more command arguments, all separated by whitespaces (spaces or tabs).

If the line starts with the # character, it is considered to be a comment and not processed by the interpreter.

If the line ends with the \ (backslash) character, the next line is considered to be a continuation of current one. This is useful for breaking long lines and improving the readability of the code.

You can also join separate commands using;, as shown in the following example:

puts ...

Get Tcl 8.5 Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.