Name

global — Use global variable from within a proc.

Synopsis

global varname [varname...]

Description

By default, Hecl variables are always local. Global variables are not visible from within procedures. The global command makes global variable varname visible within a procedure.

Example

set foo 1
proc incfoo {} {
    global foo
    incr $foo
}
incfoo
puts $foo
	  

Produces:

2