@@ -397,6 +397,41 @@ Other Operators
397
397
* ``?. `` (:ref: `null-safe operator <component-expression-null-safe-operator >`)
398
398
* ``?? `` (:ref: `null-coalescing operator <component-expression-null-coalescing-operator >`)
399
399
400
+ Operators Precedence
401
+ ~~~~~~~~~~~~~~~~~~~~
402
+
403
+ Operator precedence determines the order in which operations are processed in an
404
+ expression. For example, the result of the expression ``1 + 2 * 4 `` is ``9 ``
405
+ and not ``12 `` because the multiplication operator (``* ``) takes precedence over
406
+ the addition operator (``+ ``).
407
+
408
+ To avoid ambiguities (or to alter the default order of operations) add
409
+ parentheses in your expressions (e.g. ``(1 + 2) * 4 `` or ``1 + (2 * 4) ``.
410
+
411
+ The following table summarizes the operators and their associativity from the
412
+ **highest to the lowest precedence **:
413
+
414
+ ======================================================= =============
415
+ Operators associativity
416
+ ======================================================= =============
417
+ ``- ``, ``+ `` (unary operators that add the number sign) none
418
+ ``** `` right
419
+ ``* ``, ``/ ``, ``% `` left
420
+ ``not ``, ``! `` none
421
+ ``~ `` left
422
+ ``+ ``, ``- `` left
423
+ ``.. `` left
424
+ ``== ``, ``=== ``, ``!= ``, ``!== ``, left
425
+ ``< ``, ``> ``, ``>= ``, ``<= ``,
426
+ ``not in ``, ``in ``, ``contains ``,
427
+ ``starts with ``, ``ends with ``, ``matches ``
428
+ ``& `` left
429
+ ``^ `` left
430
+ ``| `` left
431
+ ``and ``, ``&& `` left
432
+ ``or ``, ``|| `` left
433
+ ======================================================= =============
434
+
400
435
Built-in Objects and Variables
401
436
------------------------------
402
437
0 commit comments