Version 2 of ?lappend

Updated 2004-05-14 11:45:33

proc ?lappend {v_name args} {

  upvar $v_name v
  if {![info exists v]} {
   return -code error "expected $v_name to exist!"
  }
  foreach val $args {
   lappend v $val
  }
 }

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


Category Command