1lappend(n)                   Tcl Built-In Commands                  lappend(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       lappend - Append list elements onto a variable
9

SYNOPSIS

11       lappend varName ?value value value ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       This command treats the variable given by varName as a list and appends
17       each of the value arguments to that list as a  separate  element,  with
18       spaces  between elements.  If varName doesn't exist, it is created as a
19       list with elements given by the value arguments.  Lappend is similar to
20       append except that the values are appended as list elements rather than
21       raw text.  This command provides a relatively efficient way to build up
22       large lists.  For example, ``lappend a $b'' is much more efficient than
23       ``set a [concat $a [list $b]]'' when $a is long.
24

EXAMPLE

26       Using lappend to build up a list of numbers.
27              % set var 1
28              1
29              % lappend var 2
30              1 2
31              % lappend var 3 4 5
32              1 2 3 4 5
33
34

SEE ALSO

36       list(n), lindex(n), linsert(n), llength(n), lset(n) lsort(n), lrange(n) │
37
38

KEYWORDS

40       append, element, list, variable
41
42
43
44Tcl                                                                 lappend(n)
Impressum