:= (assignment) operator

The right-associative, binary := operator is used to assign a value to a variable-annotated attribute or local variable.

Usage

variable Integer num := 1;
num := 2;

Description

You have to use := if you want to assign a value to a variable, attempting to use = will result in a compile error.

Definition

The := operator is primitive.

Polymorphism

The := operator is not polymorphic.

See also

  • [variable] annotation doc coming soon (../../ceylon.language/variable)
  • operator precedence in the language specification