image

Pause

image

The key feature of debug mode is that your script can pause in the middle of execution.

When a script is paused in debug mode:

Why Pause

The point of pausing (and of debugging) is that while your script is paused, you can examine its state.

For example, you can study the call stack, the values of your variables, the values of expressions, and the event log.

Then you can make your script proceed again (and possibly pause again).

Rules for Pausing

The most important thing to understand about debugging is when your script will pause. The rules for pausing depend, in the first place, on path of execution.

As your script runs, one line is executed, then another, then another. There are branches, so some code might not be executed. There are loops and handlers, so some code might be executed several times. Like a mouse running in a maze, the computer traces a path of execution through your code. (You can actually watch this happening in debug mode, by tracing.)

The rules for pausing are:

Tip: If your script is paused but you can’t see where (because you’ve scrolled to examine some other region of the script), choose Edit > Go to Current Line to bring the line containing the green arrow into view.

Pausing vs. Stopping

Distinguish pausing from stopping!



Execute When Debugging
image