The Break Statement

The Break statement exits the nearest enclosing cycle statement.

break-statement:

Break

The target of the Break statement is the end point of the nearest enclosing cycle statement. If this statement is not enclosed by a cycle statement, a compilation error occurs.

The Break statement cannot exit the Finally block. When this statement occurs within the Finally block, the target of the break statement must be within the same Finally block. Otherwise, a compilation error occurs.

Example

Private Sub TestContinue();
Var
    b: boolean;
Begin
    Repeat
        //Code executed in cycle
        If MessageBox.Show("Result is incorrect. Repeat calculation?",
            "Confirmation", MessageBoxButtons.OKCancel) = DialogResult.OK Then
            Continue;
        Else
            Break
        End If;
        //Code executed after confirmation
    Until b;
End Sub;

See also:

Jump Statements