1append(n) Tcl Built-In Commands append(n)
2
3
4
5______________________________________________________________________________
6
8 append - Append to variable
9
11 append varName ?value value value ...?
12_________________________________________________________________
13
14
16 Append all of the value arguments to the current value of variable var‐
17 Name. If varName doesn't exist, it is given a value equal to the con‐
18 catenation of all the value arguments. The result of this command is
19 the new value stored in variable varName. This command provides an
20 efficient way to build up long variables incrementally. For example,
21 ``append a $b'' is much more efficient than ``set a $a$b'' if $a is
22 long.
23
25 Building a string of comma-separated numbers piecemeal using a loop.
26 set var 0
27 for {set i 1} {$i<=10} {incr i} {
28 append var "," $i
29 }
30 puts $var
31 # Prints 0,1,2,3,4,5,6,7,8,9,10
32
33
35 concat(n), lappend(n)
36
37
39 append, variable
40
41
42
43Tcl append(n)