KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utilizing the Program Counter
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: May 24, 2023

The debugger can be useful to see what the code is doing for each statement which can help with identifying and troubleshooting issues. When using the debugger there are ways to improve the efficiency of testing issues.

One way to improve the efficiency of debugging is to adjust the program counter. The program counter is the yellow arrow in the left margin of the Source Code pane.

The program counter indicates the next line of code to be executed. In some scenarios, it can be useful to replay small subsections of executed code. Instead of exiting and replaying the entire method, the program counter can be repositioned by draging it to a new position. This can also be useful in some other cases such as exiting a long loop earlier. For debugging purposes, an entire loop may not be needed and the execution of the code after a loop may need investigation. Instead of canceling the execution and rewriting the code for a temporary smaller loop, the program counter can simply be dragged outside of the loop the needed amount of iterations required to test the following code.