1.2.10 $COPERATORS : Allow C like operators

This boolean switch determines whether C like assignment operators are allowed. By default, these assignments are not allowed. After the following statement:

{$COPERATORS ON}

the following operators are allowed:

var
  N : Double;
begin
  N:=1;
  N+=3; // add 3 to N and assign the result to N
  N-=2; // subtract 2 from N and assign the result to N
  N*=2; // multiply N with 2 and assign the result to N
  N/=2; // divide N with 2 and assign the result to N
end.

Operations can be performed on integers or float numbers, but division only works on float numbers. For integer division, you simply use N:=N div 2.

Note that the expression to the right of the operator is evaluated first, then the operator itself. For example, the result of the following expression will be 6, not 4:

n:=3;
n*=1+1; // n:=n*(1+1)