Skip to content

[ExpressionLanguage] Add operators precedence documentation #19860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading