({{, file.m 
is a Wolfram Language package file.}})

OpenersNotesSection(Spacer1)Details

Wolfram Language package files are plain text files that contain arbitrary Wolfram Language code to be evaluated when the package file is loaded.

Wolfram Language package files are typically created and edited using either the Wolfram System front end or the (WebLink[Wolfram Workbench, http://www.wolfram.com/products/workbench/]) application, though any editor that can read and edit plain text files will work.

Package files can be standalone programs or can be part of a larger application.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Example package code that defines a function named f in the context MyContext`:

BeginPackage[“MyContext`”]

f::usage = “f[x, y] gives the sum of x and y.”;

Begin[“Private`”]
f[x_, y_] := x + y
End[]

EndPackage[]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Get, paclet:ref/Get])  ▪  (RefLink[Needs, paclet:ref/Needs])  ▪  (RefLink[BeginPackage, paclet:ref/BeginPackage])  ▪  (RefLink[Begin, paclet:ref/Begin])}, {Related System Files:  (RefLink[init.m, paclet:ref/file/init.m])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Contexts and Packages, paclet:tutorial/ContextsAndPackages])}, {▪(RefLinkPlain[Wolfram Language Packages, paclet:tutorial/WolframLanguagePackages])}, {▪(RefLinkPlain[Setting Up Wolfram Language Packages, paclet:tutorial/SettingUpWolframLanguagePackages])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Package Development, paclet:guide/PackageDevelopment])}, {▪(RefLinkPlain[Namespace Management, paclet:guide/NamespaceManagement])}, {▪(RefLinkPlain[Standard Extra Packages, paclet:guide/StandardExtraPackages])}, {▪(RefLinkPlain[Messages, paclet:guide/Messages])}})}})