Next: Quoting Up: Tcl Previous: Variables

## Commands

Commands can return strings as a result. To substitute a command with its return value, the command is included into square brackets. The Tcl library contains a rich set of commands that cover most requirements of a programmer. There are commands to handle lists, strings, file I/O, arithmetic expressions, etc.. The control structures that Tcl provides (like if, while, etc.) are also normal Tcl commands where the conditions etc. are passed as normal arguments. This makes the Tcl syntax much simpler.

A programmer can define new commands that are handled like the built in commands by writing Tcl procedures, or by embedding new C function in the Tcl interpreter. The embedding of C functions is very easy, and the restriction to only one datatype (string) makes the passing of arguments very simple. All core commands and control structures that Tcl provides are added as C functions to the Tcl

interpreter.