Hi.Does anyone know if eval() can be combined in some way with .toString() to recognize sequentially named variables for the purpose of assigning them new values? For example for variables Var1, Var2,...Var10 which already have values, given that a condition within a loop is met can eval() and .toString() be used on the left hand side of a statement to simply specify one of the ten variables, but not their value which would be the case if only eval() was used, so that those variables can then be assigned a new value. I realize the following is not correct but conceptually something along the lines of:
for(i=1; i < 11; i++) {
if(XXX > YYY){
eval("Var"”+i).toString() = i +5;
or maybe
("Var"”+i).toString() = i + 5;
}
}
If eval() and .toString() can not be used together in this way, is anyone aware of a work around that would accomplish the same thing? Thanks.
for(i=1; i < 11; i++) {
if(XXX > YYY){
eval("Var"”+i).toString() = i +5;
or maybe
("Var"”+i).toString() = i + 5;
}
}
If eval() and .toString() can not be used together in this way, is anyone aware of a work around that would accomplish the same thing? Thanks.
Comment