Node:Commands to Do with Variables, Next:, Previous:Notation (Tcl), Up:Commands

Commands to Do with Variables

The most used command over variables is the set command. It has the form

set varName ?value?

The value of value is determined, the variable varName is set to it, and the value is returned. If there is no value argument then simply the value of the variable is returned. It is thus used to set and/or get the value of a variable.

The unset command is used to remove variables completely from the system:

unset varName ?varName varName ...?

which given a series of variable names deletes them. The empty string is always returned.

There is a special command for incrementing the value of a variable:

incr varName ?increment?

which, given the name of a variable thats value is an integer string, increments it by the amount increment. If the increment part is left out then it defaults to 1. The return value is the new value of the variable.