Clarify switch expression usage #4865
Labels
a.language
Relates to the Dart language tour
e1-hours
Can complete in < 8 hours of normal, not dedicated, work
from.team
Reported by Dash docs team member
p2-medium
Necessary but not urgent concern. Resolve when possible.
st.triage.ltw
Indicates Lead Tech Writer has triaged
dart-lang/language#3061
https://dart.dev/language/branches#switch-expressions
Change example to:The solution is to clarify that they can't be used as the beginning of an expression. Then, if they really need to do that, parenthesize it like the above example. But I think instead of parenthesizing it, these cases should really just be using a switch statement. I'm hesitant to mention the parenthesized syntax since it's a work around to achieve behavior that's already built into switch statements.
The text was updated successfully, but these errors were encountered: