Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Input and Output / File Input  /
Needs

  • Needs[" context `"] loads an appropriate file if the specified context is not already in $Packages.
  • Needs[" context `", " file "] loads file if the specified context is not already in $Packages.
  • Needs[" context `"] calls Get[" context `"]. By convention, the file loaded in this way is the one which contains a package that defines context `.
  • Example: Needs["Collatz`"] typically reads in a file named Collatz.m.
  • See the Mathematica book: Section 2.6.10.
  • See also: Get, DeclarePackage, FileNames.
  • Related package: Utilities`Package`.

    Further Examples

    This loads the package PlotField if it has not already been loaded.

    In[1]:=

    Now these package functions are available.

    In[2]:=

    Out[2]=



    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.