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

DESCRIPTION

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

EXAMPLES

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

SEE ALSO

46       expr(n), set(n)
47

KEYWORDS

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