Operator precedence
Rules determining the order in which operators are evaluated in an expression when parentheses are not explicit.
Operator precedence is necessary for all languages using infix notation. Without it, 2 + 3 * 4 would be ambiguous—should it be computed as (2 + 3) * 4 = 20 or 2 + (3 * 4) = 14? Mathematical convention says multiplication before addition, which all programming languages follow. However, precedence rules are often extended for modern syntax—comparisons, logical operators, assignment, and ternary operators all have defined precedences. Incorrect precedence can lead to subtle bugs. This is also why parser design often uses techniques like precedence climbing to handle it correctly.