Skip to content

Commit bf445b1

Browse files
committed
minor #19860 [ExpressionLanguage] Add operators precedence documentation (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
2 parents ebd54a9 + 9f0c2e9 commit bf445b1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

reference/formats/expression_language.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,36 @@ Other Operators
422422
* ``?.`` (:ref:`null-safe operator <component-expression-null-safe-operator>`)
423423
* ``??`` (:ref:`null-coalescing operator <component-expression-null-coalescing-operator>`)
424424

425+
Operators Precedence
426+
~~~~~~~~~~~~~~~~~~~~
427+
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
444+
``<``, ``>``, ``>=``, ``<=``,
445+
``not in``, ``in``, ``contains``,
446+
``starts with``, ``ends with``, ``matches``
447+
``&`` left
448+
``^`` left
449+
``|`` left
450+
``and``, ``&&`` left
451+
``or``, ``||`` left
452+
============================================= =============
453+
454+
425455
Built-in Objects and Variables
426456
------------------------------
427457

0 commit comments

Comments
 (0)