Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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