public static final class Stmt.IfElse extends wybs.lang.SyntacticElement.Impl implements Stmt
"if" Expression ':' NewLine Block ["else" ':' NewLine Block]The first expression is referred to as the condition, while the first block is referred to as the true branch. The optional second block is referred to as the false branch. The following illustrates:
function max(int x, int y) -> int:
if(x > y):
return x
else if(x == y):
return 0
else:
return y
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 |
|---|---|
Expr |
condition |
ArrayList<Stmt> |
falseBranch |
ArrayList<Stmt> |
trueBranch |
| Constructor and Description |
|---|
IfElse(Expr condition,
List<Stmt> trueBranch,
List<Stmt> falseBranch,
wybs.lang.Attribute... attributes)
Construct an if-else statement from a condition, true branch and
optional false branch.
|
IfElse(Expr condition,
List<Stmt> trueBranch,
List<Stmt> falseBranch,
Collection<wybs.lang.Attribute> attributes)
Construct an if-else statement from a condition, true branch and
optional false branch.
|
public Expr condition
public IfElse(Expr condition, List<Stmt> trueBranch, List<Stmt> falseBranch, wybs.lang.Attribute... attributes)
condition - May not be null.trueBranch - A list of zero or more statements to be executed when the
condition holds; may not be null.falseBranch - A list of zero of more statements to be executed when the
condition does not hold; may not be null.attributes - public IfElse(Expr condition, List<Stmt> trueBranch, List<Stmt> falseBranch, Collection<wybs.lang.Attribute> attributes)
condition - May not be null.trueBranch - A list of zero or more statements to be executed when the
condition holds; may not be null.falseBranch - A list of zero of more statements to be executed when the
condition does not hold; may not be null.attributes - Copyright © 2017. All rights reserved.