Skip to content
Discussion options

You must be logged in to vote

Why is the new pattern switch expressions only work with return context?

This is not the case. 'switch expressions' work anywhere you can currently use an expression.

Why are multi-line statements banned also?

Multi-line statements are not banned.

Is the old/new case pattern matching obsolete now?

Nothing has been made obsolete.

Why didn't you guys opted for the compact => arrow based pattern matching exclusively from the start and reserved "case" for legacy switching instead of mixing things hopelessly?

Because there is already a switch-statement, and we wanted a statement form to allow patterns. We also wants an expression form. The statement form was kept mostly the same as how…

Replies: 22 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Richiban
Comment options

@yanivush
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants
Converted from issue

This discussion was converted from issue #2181 on October 21, 2020 08:01.