It does not ignore the $i. When trying to concatenate the value of the variable countzeilen with the value of the variable i, it is saying that the variable countzeilen does not exist, which is true.
Though I can now see what you are getting at. You wish to use the for loop to form the three variable names countzeilen0 countzeilen1 and countzeilen2 and then access their values.
Potentially I think that coding in this manner can get very messy, my suggestion would be to start thinking of using arrays.
If you have the array variable countzeilen with say elements countzeilen(0), countzeilen(1) and countzeilen(2) etc then their name/value pairs can be accessed using :-
Code: Select all
foreach {name value} [array get countzeilen] {
# code here using $name and/or $value
}
Or you could set the value of an array element using another variable value as the element name :-
Although Tcl arrays can only be one dimentional, you can quite easily emulate multidimensional arrays using something like the following :-
Code: Select all
set countzeilen(${i},$j) "whatever"
Providing the variable i exists in the first example, or both i and j in the second then the code if fine.
I would urge you to reconsider your logic.
Otherwise, building a variable name from other strings and/or variable values, then accessing or setting the built variable value may well require the use of $$. Like I said, messy. Though sometimes possible, with care. I would not use the logic you were originally intending to use.
If you explain more completely what you are trying to do, I will try to help further.