Variable declaration and assignment

A variable is introduced with the variable keyword.

A simple variable declaration looks like this:

var counter zero_pos_32 = 0

As for constants, type inference is supported. Hence the above instruction is equivalent to:

var counter = 0

A variable can be declared without assigning an initial value. In that case a value must be assigned subsequently:

var counter zero_pos_32
// ...
counter = 1

After an object has been assigned to a variable, another object can be assigned to it subsequently:

variable counter = 0
// ...
counter = counter + 1

The scope of a variable is limited to the block of instructions in which it is declared.

results matching ""

    No results matching ""