tcl7.6 User Commands - variable






NAME

     variable - create or modify a global variable


SYNOPSIS

     variable varName ?value?





DESCRIPTION

     Creates a global  variable  named  varName  in  the  current
     namespace  context  and  sets  its protection to the current
     level.  If the variable already exists,  it  is  updated  to
     have  the  current  protection level.  If the optional value
     string is specified, the variable  is  set  to  that  value.
     This command is usually used in conjunction with the public,
     protected and private commands to declare a variable with  a
     certain protection level within a namespace.

     The varName string cannot reference  an  element  within  an
     array.   Instead, varName should reference the entire array,
     and the initialization value should be left off.  After  the
     variable has been declared, elements within the array can be
     set using ordinary set statements or the array command.

     If the variable command is used within a procedure, it  will
     still  create  or  modify  a global variable, but unlike the
     global command, it will not install an alias to the variable
     in the local call frame.



KEYWORDS

     global, namespace, private, protected, public