MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Local variable in ToExpression?


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


  • Prev by Date: Re: open URL programmatically?
  • Next by Date: problem with Inset moving text
  • Previous by thread: Re: What's the new "Code" Style?
  • Next by thread: Re: Local variable in ToExpression?