upvar
upvar ?level? otherVar localVar ?otherVar localVar ...?
Links a local name to a variable of a caller. The level is 1 for the caller (the default), 2 for its caller, or #0 for the top level. This is the way to pass a variable by name.
Examples
A click on an example runs it in the shell of the page.
proc bump {name} {upvar 1 $name v; incr v}; set c 1; bump c:2
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.