[quote=472508:@Derk Jochems]If, while, wend, do, loop until etc beaks won’t work.
They must be inside the statements as far as i know[/quote]
not true
I use breakpoints on IF all the time
if 1 = 2 then // << put a break point on this line and it will stop on it
break // it will not stop here (of course)
end if
WHILE and DO loops are the only ones I see this occur on where they do not stop at the loop top
FOR works fine
[quote=472511:@Norman Palardy]
WHILE and DO loops are the only ones I see this occur on where they do not stop at the loop top
FOR works fine[/quote]
I thought I read somewhere that while loops are evaluated at the end and that was the difference to for loops. I think I’ve seen the debugger break on the wend when the breakpoint was on the while. But I’ve also seen breakpoints get completely missed, so I don’t disbelieve your results.
but if you imagine how the compiler treats your code its as if it inserts a “If BreakPointSet Then BreakOnNextStatement” all over the place where you could set a break point. This is one reason debug code should not be used for benchmarking speed related issues
In the case of a while this might turn into (its not really like this but you get the idea)
If BreakPointSet Then BreakOnNextStatement
While i > 0
If BreakPointSet Then BreakOnNextStatement
i = i - 1
If BreakPointSet Then BreakOnNextStatement
Wend
but the initial one is missing so you either set the breakpoitn on the first line inside the loop or just accept that while loops dont work as expected
Back in the dark ages (not to be confused with Dark Mode or the Dark Side), I had a programming Professor that pounded into us “Never set a not-in-code breakpoint on a testing statement.” WHILE statements and the like are testing a condition so I won’t set a breakpoint there. He also included IF statements unless they were of the nature of if condition then break. WHILE statements fall into this category, as do ELSE, END IF, WEND, etc. I will often add an if TRUE then BREAK statement before entering a WHILE loop just so I know it will break there.
[quote=472511:@Norman Palardy]not true
I use breakpoints on IF all the time
if 1 = 2 then // << put a break point on this line and it will stop on it
break // it will not stop here (of course)
end if
WHILE and DO loops are the only ones I see this occur on where they do not stop at the loop top
FOR works fine[/quote]
Then the breakpoint is a bug. As i can remember @Greg O’Lone saying this on the forums some time ago. We had to change alot of break points.
I do see alot of FB cases about breakpoints being skipped etc none of them (can’t find any) are specific about before “IF”, “ELSE”, “WHILE”, “WEND” etc.