## Tcl9.0.3/Tk9.0.3 Documentation > Tcl Commands > append

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

append — 変数に追記する Append to variable

### 構文 SYNOPSIS

append varName ?value value value ...?

### 説明 DESCRIPTION

変数 varName の現在の値に全ての value 引数を追記する｡もし varName と謂う変数が実在しない場合､それは全ての value 引数の連結に等しい値として与えられる｡ もし varName が実在しないが無為設定で値を設定する配列の要素を指し示す場合､無為設定の値と全てのvalue 引数との連結が配列要素内に保存されることになる｡ この命令の結果は､変数 varName に保存された新しい値である｡この命令は､長い変数の逐次的な作成に効率的な方法を提供する｡譬えば､$a が長い場合､ “append a $b” の方が “set a $a$b” より効率的である｡ Append all of the value arguments to the current value of variable varName. If varName does not exist, it is given a value equal to the concatenation of all the value arguments. If varName indicate an element that does not exist of an array that has a default value set, the concatenation of the default value and all the value arguments will be stored in the array element. The result of this command is the new value stored in variable varName. This command provides an efficient way to build up long variables incrementally. For example, “append a $b” is much more efficient than “set a $a$b” if $a is long.

### 用例 EXAMPLE

コンマで区切られた数字を､繰返しを使って､少しずつ作る｡ Building a string of comma-separated numbers piecemeal using a loop.

    set var 0
    for {set i 1} {$i<=10} {incr i} {
        append var "," $i
    }
    puts $var
    # 0,1,2,3,4,5,6,7,8,9,10 が印刷される	# Prints 0,1,2,3,4,5,6,7,8,9,10

### SEE ALSO

concat, lappend

### KEYWORDS

append, variable
Copyright © 1993 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.