Package: org.codehaus.groovy.ast.stmt

## [Java] Class WhileStatement

- org.codehaus.groovy.ast.stmt.WhileStatement

- All Implemented Interfaces and Traits:
    LoopingStatement

      public class WhileStatement
      extends Statement
      implements LoopingStatement

  Represents a while (condition) { ... } loop in Groovy. The while loop repeatedly evaluates a BooleanExpression at the start of each iteration and executes the loop body only if the condition is true. If the condition is false on the first evaluation, the loop body never executes.

  See Also:
    LoopingStatement
    Statement
    BooleanExpression
    DoWhileStatement

- - ### Constructor Summary

    Constructors
    Constructor and description
    `WhileStatement(BooleanExpression booleanExpression, Statement loopBlock)` Constructs a WhileStatement with a condition and loop body.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public BooleanExpression` | `getBooleanExpression()` Returns the BooleanExpression that is evaluated at the start of each iteration.
    `` | `public Statement` | `getLoopBlock()` Returns the loop body Statement}.
    `` | `public void` | `setBooleanExpression(BooleanExpression booleanExpression)` Sets the BooleanExpression} to evaluate at the start of each iteration.
    `` | `public void` | `setLoopBlock(Statement loopBlock)` Sets the loop body 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 WhileStatement(BooleanExpression booleanExpression, Statement loopBlock)

      Constructs a WhileStatement with a condition and loop body.

      Parameters:
        `booleanExpression` - the BooleanExpression evaluated at the start of each iteration
        `loopBlock` - the Statement to execute while the condition is true

  - ### Method Detail

    - #### public BooleanExpression getBooleanExpression()

      Returns the BooleanExpression that is evaluated at the start of each iteration.

      Returns:
        the loop condition BooleanExpression}

    - #### public Statement getLoopBlock()

      Returns the loop body Statement}.

      Returns:
        the loop block Statement}

    - #### public void setBooleanExpression(BooleanExpression booleanExpression)

      Sets the BooleanExpression} to evaluate at the start of each iteration.

      Parameters:
        `booleanExpression` - the loop condition BooleanExpression}

    - #### public void setLoopBlock(Statement loopBlock)

      Sets the loop body Statement}.

      Parameters:
        `loopBlock` - the loop block Statement}

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