public static final class Stmt.VariableDeclaration extends wybs.lang.SyntacticElement.Impl implements Stmt
Type Identifier ['=' Expression] NewLineThe optional
Expression assignment is referred to as an
initialiser. If an initialiser is given, then this will be
evaluated and assigned to the variable when the declaration is executed.
Some example declarations:
int x int y = 1 int z = x + yObserve that, unlike C and Java, declarations that declare multiple variables (separated by commas) are not permitted.
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 |
expr |
WhileyFile.Parameter |
parameter |
Type |
type |
| Constructor and Description |
|---|
VariableDeclaration(WhileyFile.Parameter parameter,
Expr expr,
wybs.lang.Attribute... attributes)
Construct a variable declaration from a given type, variable name and
optional initialiser expression.
|
VariableDeclaration(WhileyFile.Parameter parameter,
Expr expr,
Collection<wybs.lang.Attribute> attributes)
Construct a variable declaration from a given type, variable name and
optional initialiser expression.
|
public final WhileyFile.Parameter parameter
public Type type
public Expr expr
public VariableDeclaration(WhileyFile.Parameter parameter, Expr expr, wybs.lang.Attribute... attributes)
pattern - Type pattern declaring one or more types.expr - Optional initialiser expression, which may be null.attributes - public VariableDeclaration(WhileyFile.Parameter parameter, Expr expr, Collection<wybs.lang.Attribute> attributes)
pattern - Type pattern declaring one or more types.expr - Optional initialiser expression, which may be null.attributes - Copyright © 2017. All rights reserved.