Hi,
Is there any neat way to increment any array element. At the moment I’m doing:
set TempVar $::MyArray($some_index)
incr TempVar
set ::MyArray($some_index) $TempVar
unset TempVar
Thanks,
Ger.
Hi,
Is there any neat way to increment any array element. At the moment I’m doing:
set TempVar $::MyArray($some_index)
incr TempVar
set ::MyArray($some_index) $TempVar
unset TempVar
Thanks,
Ger.
You could potentially one-line it with something like this:
array set TempVar { var 1 }
set TempVar [incr TempVar(var)]
You could potentially one-line it with something like this:
array set TempVar { var 1 }
set TempVar(var) [incr TempVar(var)]
Using a global array will disable CMP. You might want to check if using a table will work for your scenario as it’s CMP compatible:
Aaron