Assignment Statement Operators


 
The two operators ?=? and ?=? are added to the legal assignment operators, i.e. the complete list of legal assignment operators is: ?:=?, ?=?, ?=?, ?++?.
The meaning of the new assignment operators is as follows
A += expression is equivalent to A := A + expression
A -= expression is equivalent to  A := A expression
Example:
i += 1;
t.attr += s.attr.int_val;
amount -= 100;
 
The ?+? operator is applicable for aggregates only. The effect is that an element is added to an aggregate, if the aggregate type is SET or BAG, and appended to the aggregate if it is of type LIST. This operator is not legal for aggregates of type ARRAY. NOTE: This operator is more efficient that ?=? (union), since there is no copying of the aggregate, which is the case for union.
Example:
anAggregate ++ anAggrElement;