Let's say I created a function that calculates something inside a module. How do I assign that result to a global value?
Let's say I have this:
function[input_]:=input*5;
findRoot[fun,input]:= module[{iterations=0}, While[iterations<10, result=fun[input]];
iterations = iterations + 1; input=input/2;
savetoglobal = result];
How do I save the result to the global environment? (sorry if this example doesn't make sense).
Any help would be greatly appreciated.
result = findroot[...]
. Theresult
will contain the result of runningfindroot
with the specific parameters you gave. $\endgroup$