%, %% and %%%

In Maple, each time you execute a statement that produces anything other than a null sequence (we'll see that later), that result is automaticaly assigned to the special variable %, what was previously assigned to % is now assigned to %%, and what was previously assigned to %% becomes assigned to %%%.

If the execution of a statement produces an error, none of the three symbols are affected.

You can use these in subsequent computations if you are using Maple interactively; however, none of the examples in this introduction will use these symbols.

In the graphical user interface, you will see that you are able to move up and down and to re-execute statements, while in the command-line version, you must always enter a new statement (although you can use the up-arrow to access previous commands to be re-executed).

[> 1;

$1$

[> 2;

$2$

[> 4;

$4$

[> % + %% + %%%; # 4 + 2 + 1

$7$

[> %% + 1/2; # 4 + 1/2

$\frac{9}{2}$

[> % + 1/3; # 9/2 + 1/3

$\frac{29}{6}$

[> 1 + -3;
syntax error, `-` unexpected:
[> 1 + (-3);

$-2$

[> % + %%; # -2 + 29/6

$\frac{17}{6}$

The assignment of these three symbols is not affected by whether or not you use colons or semi-colons at the end of a statement, and is not affected by whether or not you have multiple statements in one line or on separate lines:

[> 3 - 8: 5 + 1: 7 - 5: 14 + 1:
[> %%%;

$6$

[> %%;

$15$