Skip to content

Commit c883a11

Browse files
committed
Minor tweaks
1 parent bf445b1 commit c883a11

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

reference/formats/expression_language.rst

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -425,32 +425,37 @@ Other Operators
425425
Operators Precedence
426426
~~~~~~~~~~~~~~~~~~~~
427427

428-
The following table summarize the operators and their associativity from the highest to the lowest precedence.
429-
It can be useful to understand the actual behavior of an expression.
430-
431-
To avoid ambiguities it is a good practice to add parentheses.
432-
433-
============================================= =============
434-
Operators associativity
435-
============================================= =============
436-
``-``, ``+`` none
437-
``**`` right
438-
``*``, ``/``, ``%`` left
439-
``not``, ``!`` none
440-
``~`` left
441-
``+``, ``-`` left
442-
``..`` left
443-
``==``, ``===``, ``!=``, ``!==``, left
428+
Operator precedence determines the order in which operations are processed in an
429+
expression. For example, the result of the expression ``1 + 2 * 4`` is ``9``
430+
and not ``12`` because the multiplication operator (``*``) takes precedence over
431+
the addition operator (``+``).
432+
433+
To avoid ambiguities (or to alter the default order of operations) add
434+
parentheses in your expressions (e.g. ``(1 + 2) * 4`` or ``1 + (2 * 4)``.
435+
436+
The following table summarizes the operators and their associativity from the
437+
**highest to the lowest precedence**:
438+
439+
======================================================= =============
440+
Operators associativity
441+
======================================================= =============
442+
``-``, ``+`` (unary operators that add the number sign) none
443+
``**`` right
444+
``*``, ``/``, ``%`` left
445+
``not``, ``!`` none
446+
``~`` left
447+
``+``, ``-`` left
448+
``..`` left
449+
``==``, ``===``, ``!=``, ``!==``, left
444450
``<``, ``>``, ``>=``, ``<=``,
445451
``not in``, ``in``, ``contains``,
446452
``starts with``, ``ends with``, ``matches``
447-
``&`` left
448-
``^`` left
449-
``|`` left
450-
``and``, ``&&`` left
451-
``or``, ``||`` left
452-
============================================= =============
453-
453+
``&`` left
454+
``^`` left
455+
``|`` left
456+
``and``, ``&&`` left
457+
``or``, ``||`` left
458+
======================================================= =============
454459

455460
Built-in Objects and Variables
456461
------------------------------

0 commit comments

Comments
 (0)