This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 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.