Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed May 13, 2024
1 parent bf445b1 commit c883a11
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions reference/formats/expression_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -425,32 +425,37 @@ Other Operators
Operators Precedence
~~~~~~~~~~~~~~~~~~~~

The following table summarize the operators and their associativity from the highest to the lowest precedence.
It can be useful to understand the actual behavior of an expression.

To avoid ambiguities it is a good practice to add parentheses.

============================================= =============
Operators associativity
============================================= =============
``-``, ``+`` none
``**`` right
``*``, ``/``, ``%`` left
``not``, ``!`` none
``~`` left
``+``, ``-`` left
``..`` left
``==``, ``===``, ``!=``, ``!==``, left
Operator precedence determines the order in which operations are processed in an
expression. For example, the result of the expression ``1 + 2 * 4`` is ``9``
and not ``12`` because the multiplication operator (``*``) takes precedence over
the addition operator (``+``).

To avoid ambiguities (or to alter the default order of operations) add
parentheses in your expressions (e.g. ``(1 + 2) * 4`` or ``1 + (2 * 4)``.

The following table summarizes the operators and their associativity from the
**highest to the lowest precedence**:

======================================================= =============
Operators associativity
======================================================= =============
``-``, ``+`` (unary operators that add the number sign) none
``**`` right
``*``, ``/``, ``%`` left
``not``, ``!`` none
``~`` left
``+``, ``-`` left
``..`` left
``==``, ``===``, ``!=``, ``!==``, left
``<``, ``>``, ``>=``, ``<=``,
``not in``, ``in``, ``contains``,
``starts with``, ``ends with``, ``matches``
``&`` left
``^`` left
``|`` left
``and``, ``&&`` left
``or``, ``||`` left
============================================= =============

``&`` left
``^`` left
``|`` left
``and``, ``&&`` left
``or``, ``||`` left
======================================================= =============

Built-in Objects and Variables
------------------------------
Expand Down

0 comments on commit c883a11

Please sign in to comment.