Version 7 of ?append

Updated 2006-08-03 02:42:58

proc ?append {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 {
     append v $val
   }
   return $v
 } ;# GPS

DKF: I've updated the code above to match the calling convention for append MC: I've updated the code to return the value of $val and to give the same error message if you try to append to the name of an array, like append does :-)


See also ?set, ?lappend


Category Command