Sheerpower Logo

Introduction to the REPL and Interrupting a Running Program


Everything in this section assumes that you have already installed Sheerpower. The install typically takes less than three minutes.

To use these post-install tutorials, you will work with the SPDEV IDE that was installed on your desktop, or Visual Studio Code with the Sheerpower extensions installed. If you need help getting started, see this tutorial.

Note: The online Sheerpower tutorials restrict interactive use of certain features, since misuse could cause the server to become unresponsive for other users. This section is intended for developers who have installed Sheerpower locally, where they can safely explore and use all features without such restrictions.

The Sheerpower REPL — Read–Eval–Print Loop

You can open the Sheerpower console in several ways: by starting SPDEV, using Visual Studio Code, or typing sp4gl at the Windows command prompt. This launches the Sheerpower console, which functions like a REPL (Read–Eval–Print Loop) found in many other programming languages. A REPL is an interactive programming environment where you enter code, have it evaluated immediately, and see the results printed right away. In Sheerpower, you can also enter multiple statements on a single line by separating them with a backslash (\).


sp4gl Sheerpower V0nn.0nn.nn >>> a=355 >>> b=113 >>> print a/b 3.1415929203539823 >>> >>> a=355\b=113\print a/b 3.1415929203539823 >>>

Interrupting a Running Program

When a Sheerpower program is running in its console window, you might encounter a situation where the program is taking too long to complete, or you suspect it's stuck in an infinite loop. For these moments, Sheerpower provides a powerful built-in debugging feature.

By clicking anywhere in the console window to give it focus and then pressing ALT+B, you can immediately halt the program's execution.

This action does more than just stop the program—it drops you directly into the Sheerpower REPL (Read–Eval–Print Loop) at the exact point where the program was interrupted. The console will display the source file and line number where the halt occurred, giving you immediate context.

From within this interactive state, you can:

  • Inspect Variables: Type print variable_name to see the current value of any variable.
  • Evaluate Expressions: Test conditions or perform calculations with live data.
  • Resume Execution: Type go to allow the program to proceed from where it left off.
  • Stop Execution: Type stop to terminate the program completely or simply close the window.
Tip: This feature is an invaluable tool for live debugging. It allows you to pause a running application and diagnose its state instantly, without needing to stop and restart it under a separate debugger.
(Show/Hide Sheerpower REPL & ALT+B Debugging Takeaways)
Hide Description

    

       


      

Enter or modify the code below, and then click on RUN

Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use.