Purpose
Exits a Do...Loop statement prematurely.
Restrictions
You cannot issue an Exit Do statement through the MapBasic window.
Syntax
Exit Do
Description
An Exit Do statement terminates a Do...Loop statement. Upon encountering an Exit Do statement, MapBasic will jump to the first statement following the Do...Loop statement. Note that the Exit Do statement is only valid within a Do...Loop statement.
Do...Loop statements can be nested; that is, a Do...Loop statement can appear within the body of another, "outer" Do...Loop statement. An Exit Do statement only halts the iteration of the nearest Do...Loop statement. Thus, in an arrangement of this sort:
Do While condition1
:
Do While condition2
:
If error_condition
Exit Do
End If
:
Loop
:
Loop
the Exit Do statement will halt the inner loop (Do While condition2) without necessarily affecting the outer loop (Do While condition1).
See Also:
Do...Loop statement, Exit For statement, Exit Sub statement