1incr(n)                      Tcl Built-In Commands                     incr(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       incr - Increment the value of a variable
9

SYNOPSIS

11       incr varName ?increment?
12_________________________________________________________________
13
14

DESCRIPTION

16       Increments the value stored in the variable whose name is varName.  The
17       value of the variable must be an integer.   If  increment  is  supplied
18       then  its  value  (which  must  be an integer) is added to the value of
19       variable varName;  otherwise 1 is added to varName.  The new  value  is
20       stored  as  a  decimal  string in variable varName and also returned as
21       result.
22
23       Starting with the Tcl 8.5 release, the variable varName passed to  incr 
24       may  be  unset, and in that case, it will be set to the value increment
25       or to the default increment value of 1.
26

EXAMPLES

28       Add one to the contents of the variable x:
29              incr x
30
31       Add 42 to the contents of the variable x:
32              incr x 42
33
34       Add the contents of the variable y to the contents of the variable x:
35              incr x $y
36
37       Add nothing at all to the variable x (often useful for checking whether
38       an argument to a procedure is actually integral and generating an error
39       if it is not):
40              incr x 0
41
42

SEE ALSO

44       expr(n)
45
46

KEYWORDS

48       add, increment, variable, value
49
50
51
52Tcl                                                                    incr(n)
Impressum