Qualifying a global variable is done by prefixing the variable name with the :: character sequence. This is a special case of namespace qualification where the :: prefix indicates that the variable resides in the global namespace.
Example:
set globalvar 100.2
proc test1 {} {
puts "test1: $::globalvar"
}
proc test2 {} {
puts "test2: $::globalvar"
}
test1
test2
Result:
test1: 100.2 test2: 100.2
Last Updated on 2022-01-05 by gantovnik
Recent Comments