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

Clarify switch expression usage #4887

Merged
merged 5 commits into from
May 16, 2023
Merged

Clarify switch expression usage #4887

merged 5 commits into from
May 16, 2023

Conversation

MaryaBelanger
Copy link
Contributor

@MaryaBelanger MaryaBelanger commented May 15, 2023

I don't think "return a value into some expression statement" in lines 136 and 137 exactly makes sense:

If your switch doesn't need to return a value into some expression statement,
use a switch statement instead of an expression.

I could also just say "if you need to start an expression statement with a switch, use a switch statement" if that's clearer. This seems to be where the confusion is.

Fixes #4865

Didn't change the bullet list, just moved it below the example since it's kind of weird to list out the syntax differences without having shown an example yet.

@MaryaBelanger MaryaBelanger requested a review from parlough May 15, 2023 21:50
@github-actions
Copy link

github-actions bot commented May 15, 2023

Visit the preview URL for this PR (updated for commit b4b6352):

https://dart-dev--pr4887-switch-exp-oiqmu4af.web.app

(expires Tue, 23 May 2023 20:14:28 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: d851bc446d3c4d7394c5406c6f07255afc7075f3

@MaryaBelanger MaryaBelanger requested a review from munificent May 16, 2023 16:10
Copy link
Contributor

@atsansone atsansone left a comment

Choose a reason for hiding this comment

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

LGTM: One nit you can take or leave.

@atsansone atsansone added the review.tech Awaiting Technical Review label May 16, 2023
Co-authored-by: Anthony Sansone <[email protected]>
Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Thanks so much for this. I love these adjustments. It's definitely a lot more clear!

A few minor fixes:

@parlough parlough added st.RFM.% Ready to Merge but has suggestions and removed review.tech Awaiting Technical Review labels May 16, 2023
@MaryaBelanger MaryaBelanger merged commit 1441f16 into main May 16, 2023
@parlough parlough deleted the switch-exp branch May 17, 2023 18:50
rmacnak-google pushed a commit to rmacnak-google/site-www that referenced this pull request Sep 5, 2023
Fixes dart-lang#4865 

---------

Co-authored-by: Anthony Sansone <[email protected]>
Co-authored-by: Parker Lougheed <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
st.RFM.% Ready to Merge but has suggestions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify switch expression usage
4 participants