Sometimes, your code doesn't actually produce an error, but it still doesn't work correctly. In these cases, you'll need to stop the code yourself using breakpoints.
The easiest way to set a breakpoint is to click the gray area to the left of a line of code where you would like the code to suspend execution. This will place a red dot to remind you where the breakpoint is set. Just before that line runs, your code will suspend and the code window will be displayed with that line highlighted in yellow, as shown in Figure 8-8.
At this point, you can investigate variable values as discussed previously in this chapter.
Was this article helpful?