Usage of "+=" notation

TorbenTorben Member Posts: 21

Anyone have any facts regarding usage of the notation += instead of the ordinary :=?

A += 1;
instead of
A := A + 1;

It works, but is it allowed and thereby can be expected to be supported by new compilers? :?:

I like efficient code, but have always omitted the use of the += notation because I was uncertain whether new navision compilers would support it or not.
Any comments on that?
Best rgds


  • Options
    guidorobbenguidorobben Member Posts: 157
    I did some performance tests. I += 1; is 25% faster than I := I + 1;

  • Options
    fbfb Member Posts: 246
    Quick search of the v4.0 code finds '+=' used about 140 times, including 29 times in Codeunit 6500 - Item Tracking Management and 23 times in Codeunit 99000845 - Reservation Management.

    I'm beginning to think that it's here to stay...
  • Options
    DenSterDenSter Member Posts: 8,304
    I would say don't worry about if future compilers will support it. It is part of the C/AL language, and it is widely used in Navision standard code. I use it all the time, because I hate typing if I don't have to :).
Sign In or Register to comment.