@@ -431,6 +431,41 @@ Other Operators
431
431
* ``?. `` (:ref: `null-safe operator <component-expression-null-safe-operator >`)
432
432
* ``?? `` (:ref: `null-coalescing operator <component-expression-null-coalescing-operator >`)
433
433
434
+ Operators Precedence
435
+ ~~~~~~~~~~~~~~~~~~~~
436
+
437
+ Operator precedence determines the order in which operations are processed in an
438
+ expression. For example, the result of the expression ``1 + 2 * 4 `` is ``9 ``
439
+ and not ``12 `` because the multiplication operator (``* ``) takes precedence over
440
+ the addition operator (``+ ``).
441
+
442
+ To avoid ambiguities (or to alter the default order of operations) add
443
+ parentheses in your expressions (e.g. ``(1 + 2) * 4 `` or ``1 + (2 * 4) ``.
444
+
445
+ The following table summarizes the operators and their associativity from the
446
+ **highest to the lowest precedence **:
447
+
448
+ ======================================================= =============
449
+ Operators associativity
450
+ ======================================================= =============
451
+ ``- ``, ``+ `` (unary operators that add the number sign) none
452
+ ``** `` right
453
+ ``* ``, ``/ ``, ``% `` left
454
+ ``not ``, ``! `` none
455
+ ``~ `` left
456
+ ``+ ``, ``- `` left
457
+ ``.. `` left
458
+ ``== ``, ``=== ``, ``!= ``, ``!== ``, left
459
+ ``< ``, ``> ``, ``>= ``, ``<= ``,
460
+ ``not in ``, ``in ``, ``contains ``,
461
+ ``starts with ``, ``ends with ``, ``matches ``
462
+ ``& `` left
463
+ ``^ `` left
464
+ ``| `` left
465
+ ``and ``, ``&& `` left
466
+ ``or ``, ``|| `` left
467
+ ======================================================= =============
468
+
434
469
Built-in Objects and Variables
435
470
------------------------------
436
471
0 commit comments