?lappend

proc ?lappend {v_name args} {
     upvar $v_name v
     if {![info exists v]} {
         return -code error "expected $v_name to exist!"
     }
     if {[array exists v]} {
         return -code error "can't set \"$v_name\": variable is array"
     }
     foreach val $args {
         lappend v $val
     }
     return $v
}

MG - How does this differ from lappend? Unless I'm missing something (quite possible;) it seems to work exactly the same. . .

schlenk - It errors out if the var does not exist. The original lappend does not, it creates the variable.


See also ?set, ?append