So, if you have a package formatted like so:
BeginPackage["MyPackage`"];
Begin["`Private`"];
someFunction:=(
x=3;
y=4;
out=x + y;
)
End[];
Begin["`Private`"];
anotherFunction:=(
x=5;
z=7;
out= x + z;
)
End[];
EndPackage[];
Is x
treated locally? Like if you call the function anotherFunction
, does Mathematica know the difference between the xs
since they both have the context MyPackage`Private
or is each instance of Private
independent of the other? If so, then why use Module
to make variables local rather than the Private
context.