![code on time button code on time button](https://usermanual.wiki/SHERWOOD/L0908503.243664253/asset-e.png)
Let's see what it looks like to step through our example program: click the button, go to the Console to ask for the car's average speed (type 'S'), and we can see that we press our breakpoint.
Code on time button code#
If you want to see what your code does line by line, there's no need to put a breakpoint on every line, you can step through your code. If you want the console to be always visible, you can drag it to one of the P圜harm window's edges.
![code on time button code on time button](https://codeontime.com/blog/2012/11/using-navigation-button-menu/image01.png)
The Debug tool window shows dedicated panes for frames, variables, and watches, and the console, where all the input and output information is displayed.
![code on time button code on time button](https://kbmedia2.names.co.uk/104/798cebccb32617ad94123450fd137104/AddContentButton.png)
Let's take a closer look to see how the debugger can show your what your code is doing. P圜harm creates a stub if construct, leaving you with the task of filling it with the proper contents. To do that, select the statement return self.odometer / self.time in the method average_speed and then press Ctrl+Alt+T ( Code | Surround with): To avoid running into the same problem again, let's add an if statement to check whether the time equals zero. You can also see in the debugger, that the value self.time is equal to zero: Surrounding code The debugger also shows the error message. Another breakpoint appeared as well: by default P圜harm will halt for any exception that wasn't caught in your code, and it'll show an icon of a breakpoint with a lightning bolt. P圜harm starts a debugging session and shows the Debug tool windowĬlick the button to proceed with the script execution and in the Console tab, enter S and press Enter:Ĭlick the button to resume the script execution. Next, click the icon in the gutter, next to the main clause, and choose Debug 'Car'. To create breakpoints, just click in the gutter To start debugging, you have to set some breakpoints first. We can use the P圜harm debugger to see exactly what’s happening in our code. Let’s dig a little deeper into our code to find out what’s going wrong. P圜harm reports a runtime error: a ZeroDivisionError. Let's see what happens when we start our script up, and try to find out our average speed: