public static final class Stmt.DoWhile extends wybs.lang.SyntacticElement.Impl implements Stmt
function sum([int] xs) -> int
requires |xs| > 0:
int r = 0
int i = 0
do:
r = r + xs[i]
i = i + 1
while i < |xs| where i >= 0
return r
Here, the where is optional, and commonly referred to as the
loop invariant.Stmt.Assert, Stmt.Assign, Stmt.Assume, Stmt.Break, Stmt.Case, Stmt.Continue, Stmt.Debug, Stmt.DoWhile, Stmt.Fail, Stmt.IfElse, Stmt.NamedBlock, Stmt.Return, Stmt.Skip, Stmt.Switch, Stmt.VariableDeclaration, Stmt.While| Modifier and Type | Field and Description |
|---|---|
ArrayList<Stmt> |
body |
Expr |
condition |
ArrayList<Expr> |
invariants |
| Constructor and Description |
|---|
DoWhile(Expr condition,
List<Expr> invariants,
Collection<Stmt> body,
wybs.lang.Attribute... attributes)
Construct a Do-While statement from a given condition and body of
statements.
|
DoWhile(Expr condition,
List<Expr> invariants,
Collection<Stmt> body,
Collection<wybs.lang.Attribute> attributes)
Construct a Do-While statement from a given condition and body of
statements.
|
public Expr condition
public DoWhile(Expr condition, List<Expr> invariants, Collection<Stmt> body, wybs.lang.Attribute... attributes)
condition - non-null expression.invariant - The loop invariant expression, which may be null (if no
invariant is given)body - non-null collection which contains zero or more
statements.attributes - public DoWhile(Expr condition, List<Expr> invariants, Collection<Stmt> body, Collection<wybs.lang.Attribute> attributes)
condition - non-null expression.invariant - The loop invariant expression, which may be null (if no
invariant is given)body - non-null collection which contains zero or more
statements.attributes - Copyright © 2017. All rights reserved.