Local variable in ToExpression?
- To: mathgroup at smc.vnet.net
- Subject: [mg85528] Local variable in ToExpression?
- From: "karl.daggfeldt at gih.se" <karl.daggfeldt at gih.se>
- Date: Wed, 13 Feb 2008 04:20:28 -0500 (EST)
Hi,
How can I create a local variable from text in ToExpression?
test[] := Module[{result = 0},
ToExpression["result=1"]; result]
test[] will return 0
How can I make it return 1?
(here ToExpression is creating a global variable; result=1, even though it is placed inside the Module)
Sincerely
Karl Daggfeldt