Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'How to manipulate globals in a function?' topicStudent Support Forum > General > Archives > "How to manipulate globals in a function?"

Next Comment >Help | Reply To Topic
Author Comment/Response
John F. Davis
02/23/07 12:29pm

This works:
A = {1, 2, 3, 4, 5, 6};
Goo [A_] :=
Module[{},
Print["A[3]= ", A[[5]]];
];
Goo[A]

"It prints A[3]= 5"

This does not work:
Moo [A_] :=
Module[{},
A[[5]] = 99;
Print["A[3]= ", A[[5]]];
];
Moo[A]

When I try to set the variable it fails.

URL: ,

Subject (listing for 'How to manipulate globals in a function?')
Author Date Posted
How to manipulate globals in a function? John F. Davis 02/23/07 12:29pm
Re: How to manipulate globals in a function? yehuda ben-s... 02/26/07 12:10pm
Re: How to manipulate globals in a function? John F. Davis 02/26/07 2:58pm
Re: How to manipulate globals in a function? yehuda ben-s... 02/27/07 10:14am
Re: Re: How to manipulate globals in a function? John F. Davis 02/28/07 07:44am
Re: How to manipulate globals in a function? yehuda ben-s... 02/28/07 09:19am
Re: Re: How to manipulate globals in a function? John F. Davis 02/28/07 1:13pm
Next Comment >Help | Reply To Topic