Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Clarify Range Expression by Adding Parentheses for Clarity #4659

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MaddyRizvi
Copy link

Pull Request Explanation

  • Clarified Range Expression:
    Parentheses have been added around (y + 1) in the range expression 1..(y + 1) to improve clarity. This ensures that the precedence of the + operator in the expression is clear and avoids any confusion regarding the evaluation order.

  • Improved Readability for Beginners:
    The added parentheses help beginners better understand the order of operations within the range expression. This change makes it easier to follow the logic and ensures that the range is correctly interpreted as intended.

  • Updated Example for Better Understanding:
    The code example has been modified to make the behavior of the range operation more understandable, particularly in how the upper bound is calculated. This update will help developers easily grasp how ranges work in Kotlin, with a focus on operator precedence.

Purpose of Changes:

The goal of this change is to enhance the clarity of the example and ensure that developers—especially beginners—understand how the range expression works. By adding parentheses, the expression is now more explicit, and it eliminates any ambiguity about the order in which the + operation is applied.

These updates aim to improve the overall documentation by providing clearer and more accessible examples for developers, making it easier to understand key concepts in Kotlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants