I am trying to set the value of a global variable X
from inside a function.
I want the value of this variable to change when the function is called. The function will also return the string "pass"
when called.
Here is the code:
function[] := (
X = 10;
Return["pass"];
);
However, when I set a new value for X in the function, then call the function
function[]
and then call X
, I get the OLD value of X
, implying that X
was never changed.
How would I go about doing this?
??function
and see if there is something abnormal. You can paste screenshot in the question above too. $\endgroup$