EndPackage
restores $Context and $ContextPath to their values before the preceding BeginPackage, and prepends the current context to the list $ContextPath.
Details
- Every call to EndPackage must be balanced by an earlier call to BeginPackage.
- EndPackage is typically used at the end of a Wolfram Language package.
- EndPackage returns Null.
- EndPackage resets the values of $Context, $ContextPath and $ContextAliases.
Examples
open allclose allBasic Examples (1)
Commands to define a simple package:
Modify the context and context path so that symbol creation and lookup use square`:
Here are the commands defining the function in the package:
Restore the context, but leave square` on the context path for symbol lookup:
The context is now the same as the original:
The context path is the same as the original, but with square` prepended:
Scope (1)
Use BeginPackage and EndPackage to start and end a package in a file:
The package can be loaded with Get:
Properties & Relations (3)
BeginPackage["cont`"] sets $Context to "cont`":
EndPackage restores $Context to its value before the matching BeginPackage:
BeginPackage["cont`"] sets $ContextPath to {"cont`","System`"}:
EndPackage restores $ContextPath to its value before BeginPackage with "cont`" prepended:
BeginPackage does not alter the value of $ContextAliases:
EndPackage restores $ContextAliases to its value before the matching BeginPackage:
Text
Wolfram Research (1988), EndPackage, Wolfram Language function, https://reference.wolfram.com/language/ref/EndPackage.html (updated 2021).
CMS
Wolfram Language. 1988. "EndPackage." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/EndPackage.html.
APA
Wolfram Language. (1988). EndPackage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EndPackage.html