Put Wolfram Language definitions in a standalone file to be reused or shared.

Create a new package file

Choose File New Package to create a new package file:

Add boilerplate package commands

Packages have a standard structure that follows this schema. Replace MyPackage with the name of your package:

Add definitions

Public definitions in a package are available for use when a package is loaded. Private definitions are used only internally in a package, not exposed externally.

Add both private and public definitions between Begin[`Private`] and End[].

Add usage messages for public definitions between BeginPackage[...] and Begin["`Private`"]:

Save the package

Choose File Save... and specify the package name:

Use the package

Load a package using << (Get):

After the package is loaded, you can use the public functions defined in it:

Notes

You can move a package that exists on your local machine to the Wolfram Cloud using CopyFile:

Create a new package file

Select File New Package to create a new package file:

  • The new package file is automatically saved as an unnamed file.

Add boilerplate package commands

Packages have a standard structure that follows this schema. Replace MyPackage with the name of your package:

Add definitions

Public definitions in a package are available for use when a package is loaded. Private definitions are used only internally in a package, not exposed externally.

Add both private and public definitions between Begin[`Private`] and End[].

Add usage messages for public definitions between BeginPackage[...] and Begin["`Private`"]:

Name the package

Click (unnamed) to name the package:

Use the package

Load a package using << (Get). After the package is loaded, you can use the public functions defined in it:

Notes
Package files are only available for Wolfram|One and Mathematica Online. Please see their product pages for more information.