tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
18
Task/Scope-modifiers/Tcl/scope-modifiers-1.tcl
Normal file
18
Task/Scope-modifiers/Tcl/scope-modifiers-1.tcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
set globalVar "This is a global variable"
|
||||
namespace eval nsA {
|
||||
variable varInA "This is a variable in nsA"
|
||||
}
|
||||
namespace eval nsB {
|
||||
variable varInB "This is a variable in nsB"
|
||||
proc showOff {varname} {
|
||||
set localVar "This is a local variable"
|
||||
global globalVar
|
||||
variable varInB
|
||||
namespace upvar ::nsA varInA varInA
|
||||
puts "variable $varname holds \"[set $varname]\""
|
||||
}
|
||||
}
|
||||
nsB::showOff globalVar
|
||||
nsB::showOff varInA
|
||||
nsB::showOff varInB
|
||||
nsB::showOff localVar
|
||||
Loading…
Add table
Add a link
Reference in a new issue