when
clause on default
label
#7679
Unanswered
kyoyama-kazusa
asked this question in
Language Ideas
Replies: 2 comments
-
This feels like.. I don't know if oversight is the best word, but certainly feels inconsistent with switch expressions, because the following is legal: var value = expr switch
{
_ when a => ... ,
_ when b => ... ,
_ when c => ... ,
} Granted, I guess it technically is the same syntax as the alternative mentioned above ( |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'd be willing to champion |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There is no support for
when
clause followed with adefault
label inside aswitch
statement:I must write
case var _ when ...
instead:Because a discard cannot be used as a top-level pattern, I cannot use simpler syntax like
case _ when ...
.Any suggestions here? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions