An exit statement may appear inside a while-loop or a for-loop. It causes immediate termination of the loop, with control passing to the first statement after the loop. e.g.
for i=1to100do if a[i]= x then
location = i exit endif endfor
i.e. an "infinite" while-loop that actually terminates via an exit statement at some arbitrary point in the body of the loop.
If you happen to create a real infinite loop, when using p.exe keying control-c in the console will stop your program immediately. However with pw.exe there may not be a console window, and your only option may be to terminate the process via Windows Task Manager. To avoid that situation you may want to test (gui) programs using p.exe first, or create a console window at the start of the application, for instance by executing a puts(1,"") statement.
The continue statement is closely related. It causes the next iteration to begin immediately, in effect control passes to the end for/end while statement, though you may prefer to think of it as the first statement in the loop - an end while will actually get branch straightened there, however the end for has an increment and test that need to be performed. I will let you guess what this shows:
for i=1to5do printf(1,"%d ",i) if i=3then puts(1,"is three\n")
continue endif puts(1,"is not three\n") endfor
One trap for the unwary awaits: adding continue may trigger an infinite loop unless you duplicate the required statement(s) in this kind of while loop:
if alldone thenexitendif--\ either
something +=1--/ or both endwhile