NavigationUser loginWho's new
Who's onlineThere are currently 1 user and 64 guests online.
Online users:
|
Lesson 4 - MQL4 Operations & Expressionsx + y / 100x + (y / 100) //unambiguous, recommended |
When writing compound expressions, you should be explicit and indicate with parentheses () which operators should be evaluated first. This practice will make your code easier to read and to maintain.
The following table shows the precedence assigned to the operators in the MQL4. The operators in this table are listed in precedence order: The higher in the table an operator appears, the higher its precedence. Operators with higher precedence are evaluated before operators with a relatively lower precedence. Operators on the same group have equal precedence. When operators of equal precedence appear in the same expression, a rule must govern which is evaluated first. All binary operators except for the assignment operators are evaluated from left to right. Assignment operators are evaluated right to left.
() Function call From left to right[] Array element selection
! Negation From left to right~ Bitwise negation- Sign changing operation
* Multiplication From left to right/ Division% Module division
+ Addition From left to right- Subtraction
<< Left shift From left to right>> Right shift
< Less than From left to right<= Less than or equals> Greater than>= Greater than or equals
== Equals From left to right!= Not equal
& Bitwise AND operation From left to right
^ Bitwise exclusive OR From left to right
&& Logical AND From left to right
|| Logical OR From left to right
= Assignment From right to left+= Assignment addition-= Assignment subtraction*= Assignment multiplication/= Assignment division%= Assignment module>>= Assignment right shift<<= Assignment left shift&= Assignment bitwise AND|= Assignment bitwise OR^= Assignment exclusive OR
, Comma From left to right