specifies the number of previous lines of input and output to keep in a Wolfram System session.


  • The default setting for $HistoryLength is Infinity.
  • Values of In[n] and Out[n] corresponding to lines before those kept are explicitly cleared.
  • Using smaller values of $HistoryLength can save substantial amounts of memory in a Wolfram System session.


Basic Examples  (2)

The default is to save the entire history:

Change the setting to save no history:

This means the previous input can no longer be used directly:

By assigning to a variable, you can still refer to previous results:

Introduced in 1996