Viewing the value of a variable at run-time can be useful in debugging an issue with a program.
Note: The Visual LISP IDE is available on Windows only.
When not using Visual LISP, you can use the princ function to display the current value of a variable during the execution of a program.
Display the Watch window
- In Visual LISP, click View
Watch Window.
Add a variable to the Watch window
- In Visual LISP, text editor window, double-click or select a variable name.
- Right-click and click Add Watch.
Visual LISP passes the variable’s name to the Watch window and displays its current value.
Note: If the Watch window is not already open and you want to view a variable's value, you can open the window by clicking ViewWatch Window from the Visual LISP menu bar.
If you click the Add Watch button from the Watch window without selecting a variable name from the text editor window first, the following window appears:
Remove a variable from the Watch window
- In the Watch window, select the variable to remove and right-click.
If the Watch window is not displayed, click View
Watch Window.
- Click Remove from Watch.
View the return value of the last evaluated expression
- In Visual LISP, click Debug
Watch Last Evaluation.
Visual LISP displays the Watch window, which shows the value of the *LAST-VALUE* IDE global variable. Visual LISP always stores the value of the last evaluated expression in the *LAST-VALUE* variable.