%,%%,%%% - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

The Ditto Operators


The ditto operator allows you to refer to a previously computed results in Maple.  It is represented by a percentage sign (%). Specifically, the following operators are defined:


last expression


second last expression


third last expression


These three operators are often referred to as nullary operators. These operators do not take arguments but simply return values from the environment of the Maple session.


% reevaluates the last expression computed


%% reevaluates the second last expression computed


%%% reevaluates the third last expression computed.


The sequence of expressions that defines the values of these operators is the sequence of expressions generated in a Maple session at the same level where the operator occurs, excluding the NULL value and excluding the values of the index of iteration in a for-loop.


For example, in the most common usage at the top (interactive) level of Maple, the expressions generated within a procedure invocation are hidden from the ditto operators because they are at a lower level.


When used within the body of a procedure, the ditto operators refer to the sequence of expressions generated during execution of that procedure, excluding expressions generated within any subprocedures invoked.


When using the worksheet interface, exercise caution because the ditto operators act on the expressions last evaluated in time, not space. When editing old expressions in the interface, the expression in the spatially previous line may not be the one returned by the ditto operator.


Ditto operators do not simply recall the results of past computations but instead reevaluate the results of these computations. Because this behavior can cause unnecessary recomputations, use local variables to save and recall computed expressions in programs. If reevaluation is necessary, use the eval command.


Because their interpretation can be ambiguous (due to the order in which things are executed), it is recommended that you use equation labels.

See Also

environment variables

equation labels