5.10 var
The var
keyword allows declaring multiple variables, separated by comma ,
. Each variable has a valid identifier and optionally a value assignment following the assignment operator =
. Variables can also have an explicit type-hint.
var a; // declare local a
var b:Int; // declare variable b of type Int
// declare variable c, initialized to value 1
var c = 1;
// declare variable d and variable e
// initialized to value 2
var d,e = 2;
The scoping behavior of local variables is described in Blocks.