How can I assign a value for a symbol composed of a string plus and another string converted from integer?


So I want to assign a value 4 to the new symbol as3. But it does not work.

  • $\begingroup$ Evaluate@Symbol["as" <> ToString[n]] = 4. It will only work once. $\endgroup$
    – march
    Oct 11, 2017 at 21:33
  • $\begingroup$ Linked topic should answer your question, let me know if you disagree with closing. $\endgroup$
    – Kuba
    Oct 11, 2017 at 21:36

1 Answer 1


Is this what you want?

n = 3;
Set[#, 4]& @ Symbol["as" <> ToString[n]]

Not the answer you're looking for? Browse other questions tagged or ask your own question.