Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/incr.n @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 1.7 KB
Line 
1'\"
2'\" Copyright (c) 1993 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\"
5'\" See the file "license.terms" for information on usage and redistribution
6'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7'\"
8'\" RCS: @(#) $Id: incr.n,v 1.6 2006/02/09 17:34:41 dgp Exp $
9'\"
10.so man.macros
11.TH incr n "" Tcl "Tcl Built-In Commands"
12.BS
13'\" Note:  do not modify the .SH NAME line immediately below!
14.SH NAME
15incr \- Increment the value of a variable
16.SH SYNOPSIS
17\fBincr \fIvarName \fR?\fIincrement\fR?
18.BE
19
20.SH DESCRIPTION
21.PP
22Increments the value stored in the variable whose name is \fIvarName\fR.
23The value of the variable must be an integer.
24If \fIincrement\fR is supplied then its value (which must be an
25integer) is added to the value of variable \fIvarName\fR;  otherwise
261 is added to \fIvarName\fR.
27The new value is stored as a decimal string in variable \fIvarName\fR
28and also returned as result.
29.PP
30.VS 8.5
31Starting with the Tcl 8.5 release, the variable \fIvarName\fR passed
32to \fBincr\fR may be unset, and in that case, it will be set to
33the value \fIincrement\fR or to the default increment value of \fB1\fR.
34.VE 8.5
35.SH EXAMPLES
36Add one to the contents of the variable \fIx\fR:
37.CS
38\fBincr\fR x
39.CE
40.PP
41Add 42 to the contents of the variable \fIx\fR:
42.CS
43\fBincr\fR x 42
44.CE
45.PP
46Add the contents of the variable \fIy\fR to the contents of the
47variable \fIx\fR:
48.CS
49\fBincr\fR x $y
50.CE
51.PP
52Add nothing at all to the variable \fIx\fR (often useful for checking
53whether an argument to a procedure is actually integral and generating
54an error if it is not):
55.CS
56\fBincr\fR x 0
57.CE
58
59.SH "SEE ALSO"
60expr(n)
61
62.SH KEYWORDS
63add, increment, variable, value
Note: See TracBrowser for help on using the repository browser.