Order of operators by the priority

Priority of operators within each of the listed categories rises from left to right. Priority of the whole operators category from bottom to the top.

|, & , !
>, <, >=, <=, =, #
+, -, *, /

It is important to realize, that the priority of the operators +, - or *, / is not the same. Mainly different priorities of multiplication and division may cause incorrect results in the integer logic. For example: the result of the integer expression 25*50 / 900 is 0, because as the first there is performed the division and then the multiplication. The correct result is evaluated after the modification of the expression to the form: (25*50) / 900.

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .