0

I have a static variable in my itcl class

public common x  {};

Whenever I am trying to access the variable using info exists x ($key), I get an error variable isn't array.

Am I missing something here?

Mathieu
  • 8,840
  • 7
  • 32
  • 45
wthomas
  • 35
  • 6
  • 1
    I am not familiar with itcl, but supposing normal Tcl rules still apply, once you've assigned a value to a variable, you can't access it using array syntax. If `x` is an array variable, you can use the syntax `x($key)` to check for existence, assign values, or retrieve values. But if you have assigned a value like `{}` to `x`, it can't be used as an array variable. – Peter Lewerin Nov 24 '17 at 22:37
  • What about some [MCVE]? – Mathieu Nov 27 '17 at 08:46
  • @PeterLewerin , You are right the initialization of the variable was wrong . – wthomas Nov 28 '17 at 11:12
  • @purplepsycho , Will take care of this next time Thanks – wthomas Nov 28 '17 at 11:13

0 Answers0