Re: Newbie Programming question

*To*: mathgroup at smc.vnet.net*Subject*: [mg53448] Re: [mg53436] Newbie Programming question*From*: Sseziwa Mukasa <mukasa at jeol.com>*Date*: Wed, 12 Jan 2005 03:41:19 -0500 (EST)*References*: <200501110632.BAA00755@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On Jan 11, 2005, at 1:32 AM, Kerry Kim wrote: > Hello, > > Is there any way in Mathematica to store/assign a value to a variable > whose name is in a string? In other words something like this: > > i = 17; > foo="var" + ToString[i]; > SomeFunctionThatConvertsStringToSymbolName[foo] = 17; > > and then assign some value (say, 23) to the variable whose name is > contained in the foo string? (i.e. var17=23) > You have to use Evaluate since Set has the attribute HoldFirst but the following does what you want Evaluate[ToExpression[foo]]=17 Regards, Ssezi

**References**:**Newbie Programming question***From:*Kerry Kim <kjkim@u.washington.edu>