Troubleshooting for/next loop

Dear TB gurus:

My program executes some statements within a pair of for next loops, e.g.

For p1=0.4 to 0.9 step 0.1
For P2 = 0.1 to 0.9 step 0.1 things...
next P2
Next p1

But the program consistently hangs at certain values, e.g., it will get to p1=0.7, p2 = 0.9, and then nothing error messages, the program is apparently still running, but nothing is happening.

The usual debugging tricks (trace, breakpoint) have not yet yielded insights. Any suggestions?



Troubleshooting for/next loop

Hmm, well I have isolated the problem to a subroutine (thanks Rick). But none of the debugging tricks are working now: Trace is excruciatingly slow, breakpoint crashes the program (out of memory), and I can't print values to an external file from within the sub (exception 7004, can't open the channel). Suggestions?

True Basic Silver, Windows/Vista

Trouble shooting

Hi Seth,

OK so the problem is inside a sub-routine.
First open a text file BEFORE you begin the FOR NEXT LOOPS
In the parameters to the sub-routine you must include the channel number (#1 or whatever number you used for the text file)
Inside your sub routine at convenient points PRINT #1: value
where value is a key value that you want to investigate.
When you exit the FOR NEXT LOOPS close #1

Now you can use NOTEPAD or even the TB editor to read the text file.

Big John

Troubleshooting for/next loop

Be sure that the things... doesn't accidentally change p1 or p2. You might comment out the things.. and see if the program gets through the loops. If so, the problem is inside the loops. If not, it is outside.