The global variable can be declared with the global keyword.

Example:

set globalvar 100.2
proc test1 {} {
    global globalvar
    puts "test1: $globalvar"
}
proc test2 {} {
    global globalvar
    puts "test2: $globalvar"
}
test1
test2

Result:

test1: 100.2
test2: 100.2

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading