Operators: =

Assignment operator.

Syntax

destination‑operand=operand

Assignment

The assignment operator = assigns the value of the right operand to the left destination operand. If the destination operand is a variable, an array, a local variable or a local array, then the value is written directly into the memory of the affected variable or array. If the left operand is a property, then the property associated onset method is called with the value passed in its value parameter. For example:

var string localVariable; array rect localArray[4]; // Assign a value to a local variable localVariable = "Hello World"; // Assign a value to a local array element localArray[0] = <100,200,110,220>; // Assign a value to an object variable someObject.ColorVariable = SomeTextView.Color; // Assign a value to an object array someObject.StringArray[5] = SomeTextView.String + "!"; // Assign a value to a property SomeTextView.Bounds = Bounds.orect;

Please note, unlike other programming languages, Chora doesn't support multiple assignment operations. The following expression will thus result in a Chora compilation error:

var int32 a = 10; var int32 b = 20; var int32 c = 30; var int32 d; var int32 e; // ERROR! e = ( d = a + b ) + c; // CORRECT: d = a + b; e = d + c;

Implicit type conversion

The Chora assignment operator subjects the value of the right operand to an implicit (automatic) type conversion if the data type of the right operand does not match the data type of the destination operand. For example:

var int32 a = 1369; var float b; // Convert automatically the int32 value to the float data type b = a; // b = 1369.0