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 does not 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 long.
22
24 Building a string of comma-separated numbers piecemeal using a loop.
25 set var 0
26 for {set i 1} {$i<=10} {incr i} {
27 append var "," $i
28 }
29 puts $var
30 # Prints 0,1,2,3,4,5,6,7,8,9,10
31
32
34 concat(n), lappend(n)
35
36
38 append, variable
39
40
41
42Tcl append(n)