Let me preface this question by noting that this is a simple example meant to clarify what I am asking. The actual context in which I want to implement this involves associations containing hundreds of variables, nested for loops, and writing to/reading from files. Because of this, the traditional method of setting a list of variables to a list of values (e.g. {a,b,c}={1,2,3}) is not practical.
Here is my simplified example:
Suppose I have a list of variables which have already been defined: a,b,c,d,e,f. I want to set these variables to values of 1,2,3,4,5,6 using a for loop.
To do this, I define the list:
listOfVar = {"a","b","c","d","e","f"}
And naively use the following for loop
For[i=1,i<=listOfVar,i++,
listOfVar[[i]] = i
]
Clearly, this won't work, as it will just set
listOfVar = {1,2,3,4,5}
My question is thus:
How do I replace listOfVar[[i]] with the variable name which its string represents? (e.g. how do I replace listOfVar[[3]] with the variable c so that the for loop correctly sets c to the value of 3?)
I have tried many combinations of Hold[],ToExpression[],ToString[],etc., but I do not seem to have enough knowledge of the low-level operations of Mathematica to solve this problem (or perhaps I am overlooking an obvious solution for whatever reason). I would greatly appreciate the help, as this is a problem I have given up on multiple times.