Skip to content

Commit bbf21af

Browse files
CopilotBillWagner
andcommitted
Clarify operator precedence terminology and improve examples
Co-authored-by: BillWagner <[email protected]>
1 parent c286c1e commit bbf21af

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/visual-basic/language-reference/operators/operator-precedence.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ When several operations occur in an expression, each part is evaluated and resol
2424

2525
When expressions contain operators from more than one category, they are evaluated according to the following rules:
2626

27-
- The arithmetic and concatenation operators have the order of precedence described in the following section, and all have greater precedence than the comparison, logical, and bitwise operators.
27+
- The arithmetic and concatenation operators have the order of precedence described in the following section, and all have greater precedence than the comparison, logical, and bitwise operators. Higher precedence means these operators are evaluated first.
2828

2929
- All comparison operators have equal precedence, and all have greater precedence than the logical and bitwise operators, but lower precedence than the arithmetic and concatenation operators.
3030

@@ -34,7 +34,7 @@ When several operations occur in an expression, each part is evaluated and resol
3434

3535
## Precedence Order
3636

37-
Operators are evaluated in the following order of precedence:
37+
Operators are evaluated in the following order of precedence. Operators listed first have higher precedence and are evaluated before operators listed later:
3838

3939
### Await Operator
4040

@@ -108,7 +108,9 @@ e = 1.0
108108
f = a - b + c / d * e
109109
' The preceding line sets f to 7.0. Because of natural operator
110110
' precedence and associativity, it is exactly equivalent to the
111-
' following line.
111+
' following line. Division and multiplication (/, *) have higher
112+
' precedence than addition and subtraction (+, -), so c / d * e
113+
' is evaluated first, then the addition and subtraction from left to right.
112114
f = (a - b) + ((c / d) * e)
113115
' The following line overrides the natural operator precedence
114116
' and left associativity.

0 commit comments

Comments
 (0)