Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Programming / Scoping  /
End

  • End[ ] returns the present context, and reverts to the previous one.
  • Every call to End must be balanced by an earlier call to Begin.
  • End[ ] resets the value of $Context.
  • End[ ] returns the present context name as a string of the form " context `".
  • End[ ] does not modify $ContextPath.
  • See the Mathematica book: Section 2.6.10.

    Further Examples

    Nested Begins and Ends behave properly. Here we have two nested context changes.

    In[1]:=

    Out[1]=

    The first End restores the context that was current before the last Begin.

    In[2]:=

    Out[2]=

    Another End restores the original context.

    In[3]:=

    Out[3]=

    See also the Further Examples for Begin.


    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.