Merge pull request #3117 from romanstetsyk/master
Update the operator precedence table
This commit is contained in:
commit
15dacc13de
1 changed files with 8 additions and 8 deletions
|
@ -194,18 +194,18 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en-U
|
|||
| Precedence | Name | Sign |
|
||||
|------------|------|------|
|
||||
| ... | ... | ... |
|
||||
| 15 | unary plus | `+` |
|
||||
| 15 | unary negation | `-` |
|
||||
| 14 | exponentiation | `**` |
|
||||
| 13 | multiplication | `*` |
|
||||
| 13 | division | `/` |
|
||||
| 12 | addition | `+` |
|
||||
| 12 | subtraction | `-` |
|
||||
| 14 | unary plus | `+` |
|
||||
| 14 | unary negation | `-` |
|
||||
| 13 | exponentiation | `**` |
|
||||
| 12 | multiplication | `*` |
|
||||
| 12 | division | `/` |
|
||||
| 11 | addition | `+` |
|
||||
| 11 | subtraction | `-` |
|
||||
| ... | ... | ... |
|
||||
| 2 | assignment | `=` |
|
||||
| ... | ... | ... |
|
||||
|
||||
As we can see, the "unary plus" has a priority of `15` which is higher than the `12` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
|
||||
As we can see, the "unary plus" has a priority of `14` which is higher than the `11` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
|
||||
|
||||
## Assignment
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue