От: | B0FEE664 | ||
Дата: | 22.08.18 12:57 | ||
Оценка: |
Operator precedence determines the order in which operators are evaluated. Operators with higher precedence are evaluated first.
Цитирую документацию отсюда:The following table is ordered from highest (19) to lowest (0) precedence.
...
6 Logical AND left-to-right … && …
5 Logical OR left-to-right … || …
As logical expressions are evaluated left to right, they are tested for possible "short-circuit" evaluation using the following rules:
false && (anything) is short-circuit evaluated to false.
true || (anything) is short-circuit evaluated to true.
The rules of logic guarantee that these evaluations are always correct. Note that the anything part of the above expressions is not evaluated, so any side effects of doing so do not take effect. Also, note that the anything part of the above expression is any single logical expression (as indicated by the parentheses).