[Next] [Previous] [Up] [Top] [Contents] [Index]

2.5 Statements and Expressions

2.5.4 Assignment Statements

Assignment statements have the following syntax:

assignment	::=	name ":=" expr	assignment to a variable
	|	assign_msg	assignment-like syntax for messages

If the left-hand-side is a simple name, then the closest lexically-enclosing binding of the name is located and changed to refer to the result of evaluating the right-hand-side expression. It is an error to try to assign to an object, a formal parameter, or to a variable declared without the var keyword.

If the left-hand-side has the syntax of a message, then the assignment statement is really syntactic sugar for a message send, as described in section 2.5.6.