Skip to content

Commit

Permalink
minor #19860 [ExpressionLanguage] Add operators precedence documentat…
Browse files Browse the repository at this point in the history
…ion (homersimpsons)

This PR was submitted for the 7.1 branch but it was squashed and merged into the 6.4 branch instead.

Discussion
----------

[ExpressionLanguage] Add operators precedence documentation

Closes #19803

Commits
-------

9f0c2e9 [ExpressionLanguage] Add operators precedence documentation
  • Loading branch information
javiereguiluz committed May 13, 2024
2 parents ebd54a9 + 9f0c2e9 commit bf445b1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions reference/formats/expression_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,36 @@ Other Operators
* ``?.`` (:ref:`null-safe operator <component-expression-null-safe-operator>`)
* ``??`` (:ref:`null-coalescing operator <component-expression-null-coalescing-operator>`)

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
``<``, ``>``, ``>=``, ``<=``,
``not in``, ``in``, ``contains``,
``starts with``, ``ends with``, ``matches``
``&`` left
``^`` left
``|`` left
``and``, ``&&`` left
``or``, ``||`` left
============================================= =============


Built-in Objects and Variables
------------------------------

Expand Down

0 comments on commit bf445b1

Please sign in to comment.