Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 4, 2025

The Visual Basic operator precedence documentation was confusing because it mixed "evaluated in the following order" and "greater precedence" terminology without clearly explaining their relationship. Additionally, the numeric example appeared to contradict the description, leading to user confusion about why multiplication and division operators are evaluated before addition and subtraction.

This PR makes minimal, targeted improvements to clarify the documentation:

Changes Made:

  1. Connected precedence terminology: Added explicit explanation that "Higher precedence means these operators are evaluated first" in the Precedence Rules section to clarify the relationship between "greater precedence" and evaluation order.

  2. Clarified Precedence Order section: Enhanced the introduction to state "Operators listed first have higher precedence and are evaluated before operators listed later" to make the list ordering crystal clear.

  3. Enhanced example explanation: Added detailed comment explaining why the expression f = a - b + c / d * e evaluates as f = (a - b) + ((c / d) * e), specifically noting that "Division and multiplication (/, *) have higher precedence than addition and subtraction (+, -), so c / d * e is evaluated first, then the addition and subtraction from left to right."

The mathematical example was already correct, but now readers can clearly understand why it works the way it does. These changes preserve all existing content while eliminating the terminology confusion that was causing reader difficulties.

Fixes #20696.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


Internal previews

📄 File 🔗 Preview link
docs/visual-basic/language-reference/operators/operator-precedence.md docs/visual-basic/language-reference/operators/operator-precedence

@dotnet-policy-service dotnet-policy-service bot added okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. labels Sep 4, 2025
@Copilot Copilot AI changed the title [WIP] Operator precedence description confusing Clarify operator precedence terminology and improve examples in Visual Basic documentation Sep 4, 2025
@Copilot Copilot AI requested a review from BillWagner September 4, 2025 19:37
Copilot finished work on behalf of BillWagner September 4, 2025 19:37
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review September 5, 2025 14:02
@BillWagner BillWagner requested a review from a team as a code owner September 5, 2025 14:02
@BillWagner BillWagner requested a review from gewarren September 5, 2025 14:03
@@ -34,7 +34,7 @@ When several operations occur in an expression, each part is evaluated and resol

## Precedence Order

Operators are evaluated in the following order of precedence:
Operators are evaluated in the following order of precedence. Operators listed first have higher precedence and are evaluated before operators listed later:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear that the "following" refers to the H3 headings order, so I'd add an index to the H3 headings here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-visualbasic/svc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Operator precedence description confusing
3 participants