
last, % - access to the last calculated values

Calling sequence:
last(integer)
%integer

Parameter:

integer   --  positive integer

Overloading:

all

Summary:

last(n) returns the value of the n-th calculation in the history table. Thus,
last(1) returns the last value, last(2) the penultimate one, last(3) the
last but second one, etc.  Instead of last(1) or last(3) the user can also
write more briefly %1 or %3. Instead of last(1) or %1 the user can also write
even more briefly %.

The difference between last and % is that, while with % the argument must
be a positive integer, with last it can also be an expression.

The environment variableHISTORY gives the number of results that can be
accessed.

A value returned by last or % is not re-evaluated.

last returns an error when the argument is not a positive integer. last is a

kernel function.

>>  c:=a+b+a: a:=b: last(2);

      a*2+b

>>  c:=a+b+a: a:=b: c: %1;

      b*3

See also:  HISTORY , history

