Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Disappearing variables

  • To: mathgroup at
  • Subject: [mg13759] Disappearing variables
  • From: nobody at News.Dal.Ca
  • Date: Mon, 24 Aug 1998 05:07:10 -0400
  • Organization: ISINet, Nova Scotia
  • Sender: owner-wri-mathgroup at

I want to to define a variable inside a function, as follows: f:=x=123;
Whenever I run f, x should be given the value of 123, and if x doesn't
exist, it should be created. However:

In[1]:= f:=x=123;
Out[3]:=123        ** x exists
Out[5]:=123  ** f seems to work 
Out[6]:=x     ** x doesn't exist anymore, even though f worked

It seems like x is created when I initially define f, whereas since f is
SetDelayed,  x should be created when I run f.  Does anyone know why x
is not created when I run f?

Vilis Nams

  • Prev by Date: Re: Left and right quotes
  • Next by Date: Re: Importing CSV (comma separated values) files?
  • Previous by thread: Re: Left and right quotes
  • Next by thread: Re: Disappearing variables