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