Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Arguments are not local variables' topicStudent Support Forum > General > Archives > "Arguments are not local variables"

Next Comment >Help | Reply To Topic
Author Comment/Response
Marc
07/20/06 10:57pm

I just found out that function arguments cannot be used as local variables. For example:
f[x_] :=
(x = x + 1;
x^2 + x - 7)

is illegal because x is replaced by the argument value and say f[1] would try 1 = 1+1.

Any insight on why that is? Is the only solution to use Module or Block local variables?

Cheers

URL: ,

Subject (listing for 'Arguments are not local variables')
Author Date Posted
Arguments are not local variables Marc 07/20/06 10:57pm
Re: Arguments are not local variables yehuda ben-s... 07/21/06 4:10pm
Next Comment >Help | Reply To Topic