I discovered this while writing a long nested for next loop. I had it all working great and I added some lines in the middle. I tried to run it and it had an error (like there was a nesting problem). I checked... double checked... tripple checked. Everything should of worked. I then went line by line to see if there were any other problems (like not enough brackets)... there were no other problems.
I went down the code again this time using the arrow keys and looking at each character. I noticed at the end of a "exit" command there was a space. I deleted the space and it went through without errors. It was in a for next loop. Since the help file on exit didn't mention a for next loop I figured that it may be me not using exit properly. I tried it with other loops (that were in the help file) and got the same errors. I'm using the latest update of Darkbasic Pro 5.8 and BlueIDE.
I tested this same code in the editor that came with Darkbasic Pro and found that it does show the error but only if you put a space after exit right before compiling the code. Once the error is found it's on a different line and therefore erases the space by "exit" so the program can be again compiled and work error free.
This code has a space by every "exit" but if you use the original Darkbasic editor you'll have to add a space to one line and compile (without moving to another line). If you use BlueIDE it should show an error right away (BlueIDE keeps the code exactly the way it was written).
Also adding a rem statement on the same line as exit makes it work fine.
for t=1 to 10
if t=5 then print t:exit
next t
do
inc t
if t=20 then print t:exit
loop
while t<100
inc t
if t=70 then print t:exit
endwhile
repeat
inc t
if t=110 then print t:exit
until t=200
suspend for key
Edit: I just noticed I typed "Edit Command" instead of "Exit Command" on the title... can any mods change it.