## Tcl8.6.17/Tk8.6.17 Documentation > Tcl Commands > unset

### 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

unset — 変数を消去する Delete variables

### 構文 SYNOPSIS

unset ?-nocomplain? ?--? ?name name name ...?

### 説明 DESCRIPTION

この命令は一つ或はそれ以上の変数を取去る｡それぞれの name は変数の名前であり､ set 命令に受入れられるどれかの方法で指定される｡もし name が配列の要素を参照していると､その要素だけが､残りの配列に影響を与えることなく取去られる｡もし name が括弧付きの指定なしに配列名を構成していると､配列全体が消去される｡この unset 命令は結果として空文字列を返す｡もし､最初の引数として -nocomplain が指定されていると､起り得るどの様な不都合も抑制される｡この指示項目は起りうる変数名との曖昧さを避ける為に短縮してはならない｡指示項目 -- は指示項目の終わりを指し示し､いずれかの指示項目と同じ名前の変数を取去りたい時に使うことができる｡もし､変数消去の間に不都合が生じると､不都合を生じた名前の後ろの変数は消去されない｡不都合は､指名された変数が実在しないか､又は配列要素を参照した名前が単純変数であるか､又は変数を参照した名前が存在しない名前空間である時に生じる｡ This command removes one or more variables. Each name is a variable name, specified in any of the ways acceptable to the set command. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted. The unset command returns an empty string as result. If -nocomplain is specified as the first argument, any possible errors are suppressed. The option may not be abbreviated, in order to disambiguate it from possible variable names. The option -- indicates the end of the options, and should be used if you wish to remove a variable with the same name as any of the options. If an error occurs during variable deletion, any variables after the named one causing the error are not deleted. An error can occur when the named variable does not exist, or the name refers to an array element but the variable is a scalar, or the name refers to a variable in a non-existent namespace.

### 用例 EXAMPLE

値が数の平方に対応する配列を幾つか作成し､非素数の要素の配列を取り去る: Create an array containing a mapping from some numbers to their squares and remove the array elements for non-prime numbers:

    array set squares {
        1 1    6 36
        2 4    7 49
        3 9    8 64
        4 16   9 81
        5 25  10 100
    }

    puts "The squares are:"
    parray squares

    unset squares(1) squares(4) squares(6)
    unset squares(8) squares(9) squares(10)

    puts "The prime squares are:"
    parray squares

### SEE ALSO

set, trace, upvar

### KEYWORDS

remove, variable
Copyright © 1993 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.
Copyright © 2000 Ajuba Solutions.