Debian Codegraph @

doc/append.n

raw
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 .TH append n "" Tcl "Tcl Built-In Commands"
9 .so man.macros
10 .BS
11 '\" Note: do not modify the .SH NAME line immediately below!
12 .SH NAME
13 append \- Append to variable
14 .SH SYNOPSIS
15 \fBappend \fIvarName \fR?\fIvalue value value ...\fR?
16 .BE
17 .SH DESCRIPTION
18 .PP
19 Append all of the \fIvalue\fR arguments to the current value
20 of variable \fIvarName\fR. If \fIvarName\fR does not exist,
21 it is given a value equal to the concatenation of all the
22 \fIvalue\fR arguments.
23 The result of this command is the new value stored in variable
24 \fIvarName\fR.
25 This command provides an efficient way to build up long
26 variables incrementally.
27 For example,
28 .QW "\fBappend a $b\fR"
29 is much more efficient than
30 .QW "\fBset a $a$b\fR"
31 if \fB$a\fR is long.
32 .SH EXAMPLE
33 Building a string of comma-separated numbers piecemeal using a loop.
34 .PP
35 .CS
36 set var 0
37 for {set i 1} {$i<=10} {incr i} {
38 \fBappend\fR var "," $i
39 }
40 puts $var
41 # Prints 0,1,2,3,4,5,6,7,8,9,10
42 .CE
43 .SH "SEE ALSO"
44 concat(n), lappend(n)
45 .SH KEYWORDS
46 append, variable
47 '\" Local Variables:
48 '\" mode: nroff
49 '\" End: