To View the Return Value of the Most Recent Expression Evaluated (AutoLISP/VS Code)

Note: Debugging is not available in AutoCAD LT.

While debug is active and as you step through AutoLISP expressions, you can watch the return value of the most recently evaluated expression using the *last-value* variable. The *last-value* variable must be added manually to the Watch section.

  1. In Visual Studio Code, start debugging an AutoLISP source (LSP) file.
  2. On the Activity Bar, click Debug and Run (or click View menu > Debug).
  3. In the Watch section, right-click (or secondary click on Mac OS) and choose Add Expression.
  4. In the in-place editor, type *last-value* and press Enter.


    Now, when debug is active and execution is interrupted with a breakpoint, the value of the most recently evaluated expression will be displayed adjacent to the *last-value* variable in the Watch section.