[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] global variables in tcl



Hi,

Is it possible to get a variable value which is changed by a procedure in tcl?

For example, suppose in my tcl script I have
set num 2

and in procedure
proc test {}
{
  global num
  set $num 3
}

if after test is called, I have the following statement

puts "num =$num"

can I get num=3 instead of 2? I tried but it doesn't seem so. So how can I get the value of a variable which is changed inside a procedure?

Thank you.