Package: org.codehaus.groovy.ast.stmt

## [Java] Class BreakStatement

- org.codehaus.groovy.ast.stmt.BreakStatement

-     public class BreakStatement
      extends Statement

  Represents a break statement that terminates execution of a loop or switch statement. When a break statement is encountered, control flow exits the current loop or switch, continuing at the statement following the loop or switch. Labeled break statements can exit outer loops or switch statements.

  See Also:
    SwitchStatement
    LoopingStatement
    ContinueStatement
    Statement

- - ### Constructor Summary

    Constructors
    Constructor and description
    `BreakStatement()` Constructs an unlabeled break statement that exits the innermost enclosing loop or switch.
    `BreakStatement(String label)` Constructs a labeled break statement that exits the enclosing loop or switch with the given label.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public String` | `getLabel()` Returns the label associated with this break statement.
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Statement` | `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public BreakStatement()

      Constructs an unlabeled break statement that exits the innermost enclosing loop or switch.

    - #### public BreakStatement(String label)

      Constructs a labeled break statement that exits the enclosing loop or switch with the given label.

      Parameters:
        `label` - the name of the label to break to, or null for an unlabeled break

  - ### Method Detail

    - #### public String getLabel()

      Returns the label associated with this break statement.

      Returns:
        the label name, or null if this is an unlabeled break statement

    - #### public void visit(GroovyCodeVisitor visitor)