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