Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Leaving unchanged the definition of a function' topicStudent Support Forum > General > "Leaving unchanged the definition of a function"

Next Comment >Help | Reply To Topic
Author Comment/Response
dami
04/19/08 9:46pm

Say I define the function:

X = 1;
SampleFunction = # + X &;

What should I do so that if later in the code I change the value of X, the value returned by SampleFunction is still based on the original X=1?

In other words, I want SampleFunction[10] to return 11 even if X is changed to a different value.

Many many thanks!!!





URL: ,

Subject (listing for 'Leaving unchanged the definition of a function')
Author Date Posted
Leaving unchanged the definition of a function dami 04/19/08 9:46pm
Re: Leaving unchanged the definition of a funct... yehuda ben-s... 04/21/08 09:28am
Next Comment >Help | Reply To Topic