|
Arithmetic Operations
Arithmetic operations include additive and multiplicative operations:
Sum of variables i = j + 2;
|
Increment and decrement operations are applied only to variables, they can't be applied to constants. The prefix increment (++i) and decrement (--k) are applied to the variable right before this variable is used in an expression.
Post-increment (i++) and post-decrement (k--) are applied to the variable right after this variable is used in an expression.
Important Notice
int i=5;
|
Computational problems may occur while moving the above expression from one programming environment to another one (for example, from Borland C++ to MQL5). In general, the order of computations depends on the compiler implementation. In practice, there are two ways to implement the post-decrement (post-increment):
Currently the first way of post-decrement (post-increment) calculation is implemented in MQL5. But even knowing this peculiarity, it is not recommended to experiment with its use.
Examples:
int a=3;
|
See also