Basic Language Features

; or newline

Statement separator

\

Statement continuation if last character in line

#

Comment (null command)

var

Simple variable

var(index)

Associative array variable

var(i,j,...)

Multidimensional array variable

$var

Variable substitution (also ${var})

[command]

Command substitution

\char

Backslash substitution (see "Backslash Substitutions,” later in this chapter)

"string"

Quoting with variable substitution

{string}

Quoting with no substitution (deferred substitution)

The only data type in Tcl is a string. However, some commands interpret arguments as numbers or boolean values. Here are some examples:

Integer

123 0xff 0377

Floating point

2.1 3. 6e4 7.91e+16

Boolean

true false 0 1 yes no

Get Tcl/Tk in a Nutshell 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.