Syntax:
Exit Do
Exit For
Exit Function
Exit Do |
Provides a way to exit a Do...Loop statement. It can be used only inside a Do...Loop statement. Exit Do transfers control to the statement following the Loop statement. If used within nested Do...Loop statements, then Exit Do transfers control to the loop that is one nested level above the loop where it occurs. |
Exit For |
Provides a way to exit a For loop. It can be used only in a For...Next or For Each...Next loop. Exit For transfers control to the statement following the For...Next statement. If used within nested For...Next loops, then Exit For transfers control to the loop that is one nested level above the loop where it occurs. |
Exit Function |
Immediately exits the procedure in which it appears. |
Note:
For similar purpose in the
JavaScript language is used the statement
break.