1<HTML><HEAD><TITLE>Built-In Commands - append manual page</TITLE></HEAD><BODY> 2<H3><A NAME="M2">NAME</A></H3> 3append - Append to variable 4<H3><A NAME="M3">SYNOPSIS</A></H3> 5<B>append </B><I>varName </I>?<I>value value value ...</I>?<BR> 6<H3><A NAME="M4">DESCRIPTION</A></H3> 7Append all of the <I>value</I> arguments to the current value 8of variable <I>varName</I>. If <I>varName</I> doesn't exist, 9it is given a value equal to the concatenation of all the 10<I>value</I> arguments. 11The result of this command is the new value stored in variable 12<I>varName</I>. 13This command provides an efficient way to build up long 14variables incrementally. 15For example, ``<B>append a $b</B>'' is much more efficient than 16``<B>set a $a$b</B>'' if <B>$a</B> is long. 17<H3><A NAME="M5">EXAMPLE</A></H3> 18Building a string of comma-separated numbers piecemeal using a loop. 19<PRE>set var 0 20for {set i 1} {$i<=10} {incr i} { 21 <B>append</B> var "," $i 22} 23puts $var 24# Prints 0,1,2,3,4,5,6,7,8,9,10</PRE> 25<H3><A NAME="M6">SEE ALSO</A></H3> 26<B><A HREF="../TclCmd/concat.htm">concat</A></B>, <B><A HREF="../TclCmd/lappend.htm">lappend</A></B> 27<H3><A NAME="M7">KEYWORDS</A></H3> 28<A href="../Keywords/A.htm#append">append</A>, <A href="../Keywords/V.htm#variable">variable</A> 29<HR><PRE> 30<A HREF="../copyright.htm">Copyright</A> © 1993 The Regents of the University of California. 31<A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. 32<A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> 33</BODY></HTML> 34