I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default value (e.g. 0) so I could execute in next cell


It is important that it is done this way - I don't want return from function. (I'm automatically importing variable names and values from Python)

  • $\begingroup$ This one 2926 or maybe some from links linked there: 6511 $\endgroup$
    – Kuba
    Apr 27, 2015 at 22:30
  • $\begingroup$ Generally something like (Evaluate[Symbol[#]] = 0) & /@ {"apple", "pear"}? if so there is a duplicate, I just can't find it. $\endgroup$
    – Kuba
    Apr 27, 2015 at 22:33
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$
    – bbgodfrey
    Apr 27, 2015 at 23:15
  • $\begingroup$ @Kuba : your code works, thanks! (you can post it as an answer if you want to) $\endgroup$
    – Bruno Cuc
    May 1, 2015 at 2:41


Browse other questions tagged or ask your own question.