precedence

Typeglossary
DictionaryLCS
LibraryLiveCode Script
Synonymsprecedence,operator precedence
RelatedOperator: *, +
Glossary: evaluate, operator, expression
Description

The set of rules that determine what order operators are evaluated in, in an expression that has more than one operator. Simplified, the rules for numeric operators are as follows:

  1. Operations grouped by parentheses.
  2. Exponentiation.
  3. Multiplication and division, from left to right.
  4. Addition and subtraction, from left to right.

For example, the * operator has higher precedence than the + operator, so 2 + 3 * 4 is evaluated as 2 + (3 * 4), not (2 + 3) * 4.