1global(n)                    Tcl Built-In Commands                   global(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       global - Access global variables
9

SYNOPSIS

11       global varname ?varname ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       This  command  has  no  effect unless executed in the context of a proc
17       body.  If the global command is executed in the context of a proc body,
18       it creates local variables linked to the corresponding global variables
19       (and therefore these variables are listed by info locals).
20
21       If varname contains namespace qualifiers, the local variable's name  is
22       the  unqualified  name  of  the  global  variable, as determined by the
23       namespace tail command.
24

EXAMPLES

26       This procedure sets the namespace variable ::a::x
27              proc reset {} {
28                  global a::x
29                  set x 0
30              }
31
32       This procedure accumulates the strings passed to it in a global buffer,
33       separated  by  newlines.   It is useful for situations when you want to
34       build a message piece-by-piece (as if with puts)  but  send  that  full
35       message in a single piece (e.g. over a connection opened with socket or
36       as part of a counted HTTP response).
37              proc accum {string} {
38                  global accumulator
39                  append accumulator $string \n
40              }
41
42

SEE ALSO

44       namespace(n), upvar(n), variable(n)
45
46

KEYWORDS

48       global, namespace, procedure, variable
49
50
51
52Tcl                                                                  global(n)
Impressum