Class ForStmt

  • All Implemented Interfaces:
    NodeWithBody<ForStmt>, NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Cloneable

    public final class ForStmt
    extends Statement
    implements NodeWithBody<ForStmt>

    The classic for statement

    Examples:
    1. for(int a=3, b=5; a<99; a++, b++) hello();
    2. for(a=3, b=5; a<99; a++) { hello(); }
    3. for(a(),b();;) hello();
    • initialization is a list of expressions. These can be any kind of expression as can be seen in example 3, but the common ones are a single VariableDeclarationExpr (which declares multiple variables) in example 1, or a list of AssignExpr's in example 2.
    • compare is an expression, in example 1 and 2 it is a BinaryExpr. In example 3 there is no expression, it is empty.
    • update is a list of expressions, in example 1 and 2 they are UnaryExpr's. In example 3 there is no expression, the list empty.
    • body is a statement, in example 1 and 3 it is an ExpressionStmt. in example 2 it is a BlockStmt.
    Author:
    Julio Vilmar Gesser
    See Also:
    VariableDeclarationExpr