Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Package Development > Namespace Management >

Begin

Begin["context`"]
resets the current context.
  • The interpretation of symbol names depends on context. Begin thus affects the parsing of input expressions.
Define a function f in the MyContext` Context:
Restore the context:
f will generally be hidden in the restored context:
The definitions are all in MyContext`f :
The function can be called using its fully qualified name:
Define a function f in the MyContext` Context:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Restore the context:
In[3]:=
Click for copyable input
Out[3]=
f will generally be hidden in the restored context:
The definitions are all in MyContext`f :
The function can be called using its fully qualified name:
In[6]:=
Click for copyable input
Out[6]=
Make symbols used for package function definitions private, reducing the possibility for conflict:
Any use of the symbol f in the package context ensures that f is created in that context:
When the context given to Begin starts with ` it extends from the current context:
Since the symbol f is in the package context, the function works after EndPackage:
You can see that the other variable uses the private context:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team