public class DoWhileStatement
extends Statement
implements LoopingStatement
Represents a do { ... } while (condition) loop in Groovy. A do-while loop executes its body unconditionally on the first iteration, then evaluates a BooleanExpression after each iteration to decide whether to repeat. The loop body always executes at least once, differentiating it from a WhileStatement.
| Constructor and description |
|---|
DoWhileStatement(BooleanExpression booleanExpression, Statement loopBlock)Constructs a DoWhileStatement with a loop body and condition. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public BooleanExpression |
getBooleanExpression()Returns the BooleanExpression} evaluated after each iteration. |
|
public Statement |
getLoopBlock()Returns the loop body Statement}. |
|
public void |
setBooleanExpression(BooleanExpression booleanExpression)Sets the BooleanExpression} to evaluate after each iteration. |
|
public void |
setLoopBlock(Statement loopBlock)Sets the loop body 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 a DoWhileStatement with a loop body and condition.
booleanExpression
- the BooleanExpression} evaluated after each iterationloopBlock
- the Statement} to execute; always runs at least onceReturns the BooleanExpression} evaluated after each iteration.
Sets the BooleanExpression} to evaluate after each iteration.
booleanExpression
- the loop condition BooleanExpression}Sets the loop body Statement}.
loopBlock
- the loop block Statement}Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.