Subject: Iterated variables - DN [1]


"Emmanuel MARY" <emmanuel.mary@almas.fr> - 24 May 2000 - comp.lang.tcl

 I'm a "newbie" in tcl, and it's my first post in this groop, so I'm sorry if
 this seems a silly question to you:

 I got variables named Var1, Var2, Var3 ... ect
 I want to look at the content of all these variables, one by one, in an
 iteration loop like this :

 for { set i 1 } { $i <= 9 } { incr i } {
     if { $Var$i" == "#" }

         ...
     }
 }

 But  $Var$i is a syntax error.
 How can I look at the contents of the variable, using $i in the name of the
 variable?

 Thank you.

 Emm.

Last modified
2000-07-20

(195.108.246.52)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated