Note: information on this page refers to Ceylon 1.1, not to the current release.

variable annotation

The variable annotation marks a reference that may be assigned more than once.


void example() {
    variable Integer i;
    i = 1;
    i = 2;


By default, references are immutable. They are assigned a value once, and may not be reassigned. The Ceylon compiler statically verifies that a reference not declared variable is never assigned more than once. The variable annotation disables this verification, allowing a reference to be assigned multiple times.

See also