Version 1 of take

Updated 2007-05-08 13:11:11 by suchenwi

Richard Suchenwirth 2007-05-08 - The functionality of take is to retrieve the value from a variable, which is then unset. This is very simple, as you'll immediately see, but can be useful - I needed it for the global textvariable of a dialog. As the variable was named like the dialog window, which in turn had a name constructed with clock clicks, the global variables causes pollution of ::. By using take when returning the result, the variable is now immediately unset.

 proc take _var {
    upvar 1 $_var var
    return [set var][unset var]
 }

Category example