Expressions View


The Expressions view is a view provided by the Debug perspective. It is not opened by default, but can be opened with the Show View menu.

Variables View

The Expressions view does not look very interesting until you add some expressions to be evaluated. You can do this by right-clicking and choosing Add Watch Expression.

Variables View

This allows you to enter a Mathematica expression that will be computed whenever a breakpoint is reached and whenever a new stack frame is selected. For example, if you enter RandomReal[], this shows how the computation is updated.

Variables View

It is particularly useful to use the Expressions view to track the values of local variables in your computation. This can be done by wrapping the name of the local variable in VariableValue. A button, VariableValue, is provided in the toolbar for this useful task. If you select a variable and click this button, it will add VariableValue. If the variable already uses VariableValue, it will be removed. After VariableValue has been added, it should look as below. Note that this only works when you have launched Mathematica.

Variables View

Now when you hit a breakpoint, the value of the variable will be displayed. In the example above, the value of the variable x is 10. VariableValue works even if the variable has been renamed by the Mathematica localization renaming system, or if the variable is actually in a special namespace. At present, it only shows the bottommost variable of a given name in the evaluation stack; it cannot show the values of variables higher in the stack.

From the Expressions view context menu, you can also copy the value of a variable and paste it into a Mathematica session.