Here is a BASIC Stamp Debugging tutorial(As suggested by vaclav_sal):
What is DEBUGGING
Debugging is a simple way to locate and fix errors within your program. It is a very easy thing to do but if not done correctly or not done at all, it is very hard to find an error within your code
Through the use of the debug commands, you are able to detect accidental infinite loops; assure that the math or computations the BASIC Stamp is doing are being done correctly; find and then fix bugs or errors in your code; and altogether become a better programmer!