This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


is an option for Cell which specifies the context to use for the evaluation of the contents of the cell.
  • The following settings can be given:
"context`"explicit context
Notebookunique to this notebook
CellGroupunique to this cell group
Cellunique to this cell
  • The default setting is CellContext->"Global`".
  • With CellContext->Cell, a unique default context is used for the current cell. This context is always different from the default contexts of all other cells, but stays the same for all evaluations done in the current cell.
  • With CellContext->CellGroup, a unique default context is used that is shared between all cells in the nearest enclosing group that includes the current cell and any output generated from it.
  • With CellContext->Notebook, a unique default context is used that is shared between all cells in the current notebook.
  • CellContext effectively allows sequences of evaluations to be isolated from each other within a single Mathematica session.
  • By changing the default context using CellContext, values of session variables such as In, Out and $Line are effectively localized.
  • The values of $Context and $ContextPath are taken to be local to the context defined by CellContext. Any modifications made to them will affect all cells with the same default context.
  • Packages must typically be loaded separately in each default context generated by CellContext. The packages will not normally be visible across different default contexts.
  • CellContext is often set at the level of stylesheets or complete notebooks rather than individual cells.
  • Typical context names generated by CellContext->Cell are of the form Cell$n.
New in 6