You can send a message to an object to perform an action, obtain a result, or both. You use a message instruction if the main purpose of the message is to perform an action. You use a message term (see Message Terms) if the main purpose of the message is to obtain a result.
A message instruction is a clause of the form:
>>-messageterm--+-------------+--;----------------------------->< +-=expression-+
If there is only a messageterm, the message is sent in exactly the same way as for a message term (see Message Terms). If the message yields a result object, it is assigned to the sender's special variable RESULT. If you use the ~~ form of message term, the receiver object is used as the result. If there is no result object, the variable RESULT is dropped (becomes uninitialized). A message term using ~~ is sometimes referred to as a cascading message.
Example:
mytable~add("John",123)
This sends the message ADD to the object MYTABLE. The ADD method need not return a result. If ADD returns a result, the result is assigned to the variable RESULT.
The equal sign (=) sets a value. If =expression follows the message term, a message is sent to the receiver object with an = concatenated to the end of the message name. The result of evaluating the expression is passed as the first argument of the message.
Example:
person~age = 39 /* Same as person~"AGE="(39) */ table[i] = 5 /* Same as table~"[]="(5,i) */
The expressions are evaluated in the order in which the arguments are passed to the method. That is, the language processor evaluates the =expression first. Then it evaluates the argument expressions within any [] pairs from left to right.
The extended assignment form may also be used with messaging terms.
Example:
table[i] += 1 -- Same as table[i] = table[i] + 1
See Extended Assignments for more details