As a scripting language, Tcl has a simple syntax. Either a New Line or a semicolon separates each Tcl command (;). Semicolons allow multiple commands on a single line. Keyword commands can be lower or upper case. ACTION commands are CAPITALIZED.
Tcl Commands have the basic form:
command arg arg arg
Tcl commands consist words separated by spaces. The first word is the name of the command, and the remaining words are arguments to the command. An example is
expr 2000 + 2
This command computes the sum of 2000 and 2 and returns the result, 2002.
In the above example there are four words:
2. The first word is
the name of a command and the other words are
arguments to that command.
expr command uses all
arguments together as an arithmetic expression. The result of
that expression is a string (i.e. text). In the
expr command, the
division into words isn't significant: you could just as easily
have invoked the same command as
expr 2+2000 (two
However, for most commands the word structure is important, with each word used for a distinct purpose.
All Built-In Tcl KEYWORD commands return results. If a KEYWORD command has no meaningful result then it returns an empty string as its result. Most ACTION commands do not return a result.