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.
| 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. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public String |
getLabel()Returns the label associated with this break statement. |
|
public void |
visit(GroovyCodeVisitor visitor) |
| 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 |
Constructs an unlabeled break statement that exits the innermost enclosing loop or switch.
Constructs a labeled break statement that exits the enclosing loop or switch with the given label.
label - the name of the label to break to, or null for an unlabeled breakReturns the label associated with this break statement.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.