Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/lappend.n @ 37

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

added tcl to libs

File size: 1.5 KB
Line 
1'\"
2'\" Copyright (c) 1993 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\" Copyright (c) 2001 Kevin B. Kenny <kennykb@acm.org>.  All rights reserved.
5'\"
6'\" See the file "license.terms" for information on usage and redistribution
7'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8'\"
9'\" RCS: @(#) $Id: lappend.n,v 1.16 2008/03/26 09:59:22 dkf Exp $
10'\"
11.so man.macros
12.TH lappend n "" Tcl "Tcl Built-In Commands"
13.BS
14'\" Note:  do not modify the .SH NAME line immediately below!
15.SH NAME
16lappend \- Append list elements onto a variable
17.SH SYNOPSIS
18\fBlappend \fIvarName \fR?\fIvalue value value ...\fR?
19.BE
20
21.SH DESCRIPTION
22.PP
23This command treats the variable given by \fIvarName\fR as a list
24and appends each of the \fIvalue\fR arguments to that list as a separate
25element, with spaces between elements.
26If \fIvarName\fR does not exist, it is created as a list with elements
27given by the \fIvalue\fR arguments.
28\fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs
29are appended as list elements rather than raw text.
30This command provides a relatively efficient way to build up
31large lists.  For example,
32.QW "\fBlappend a $b\fR"
33is much more efficient than
34.QW "\fBset a [concat $a [list $b]]\fR"
35when \fB$a\fR is long.
36.SH EXAMPLE
37Using \fBlappend\fR to build up a list of numbers.
38.CS
39% set var 1
401
41% \fBlappend\fR var 2
421 2
43% \fBlappend\fR var 3 4 5
441 2 3 4 5
45.CE
46
47.SH "SEE ALSO"
48list(n), lindex(n), linsert(n), llength(n), lset(n),
49lsort(n), lrange(n)
50
51.SH KEYWORDS
52append, element, list, variable
Note: See TracBrowser for help on using the repository browser.