next up previous
Next: Associativity Up: Operators Previous: Operators

Precedence

In an expression with more than one operator, we need to know which operator to evaluate first. For example, the arithmetical expression 1 + 2 * 3$ is potentially ambiguous. It could be (i.e. 9), or (i.e. 7). In fact, the convention in mathematics is to the latter: multiplication has precedence over addition. The * operator in Prolog is defined so that it too has precedence over the + operator.

Steve Harlow 2001-11-26