Описание тега operator-precedence
In mathematics and computer programming, operators such as "+", "*", and "!" are applied in a defined order when they appear together in an expression so that every expression will be evaluated the same way across multiple environments. The order in which they are applied is called the precedence of the operators. This tag is distinct from order-of-execution which concern the order in which things like callback functions or event handlers are executed in a software system.
For example, the expression
a + b > a * b || !skip
would be ambiguous if the order in which operators are evaluated was undefined. In most computer languages those operators have the following precedence
- ! (logical not)
- * (multiplication)
- + (addition)
- > (boolean "greater than")
- || (boolean "or")
So the expression would be evaluated
- !skip
- a * b
- a + b
- (a + b) > (a * b)
- ((a + b) > (a * b)) || (!skip)
This tag is for questions that concern how such expressions are evaluated in a programming language.