5.33.2 Basic syntax

Tcl scripts contain one or more commands separated by either new lines or semicolons. A Tcl command consists of the name of the command followed by one or more arguments. The format of a Tcl command is:

command arg1 ... argN

The command in the following example computes the sum of 2 plus 2 and returns the result, 4.

expr 2 + 2

The expr command handles its arguments as an arithmetic expression, computing and returning the result as a string. All Tcl commands return results. If a command has no result to return, it returns an empty string.

To continue a command on another line, enter a backslash (\) character at the end of the line. For example, the following Tcl command appears on two lines:

import -format "edif" -netlist_naming "Generic" -edif_flavor "GENERIC" {prepi.edn} Comments must be preceded by a hash character (#). The comment delimiter (#) must be the first character on a line or the first character following a semicolon, which also indicates the start of a new line. To create a multi-line

comment, you must put a hash character (#) at the beginning of each line.

Be sure that the previous line does not end with a continuation character (\). Otherwise, the comment line following it will be ignored.