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
Add match expression page #206
Conversation
Still missing, IMO:
Recommended: A comparison with ternaries, not just switch. I've been saying since day 1 that match is more akin to a multi-armed ternary than it is to a switch statement. 😄 Optional: Note that if more complex checks than === are needed, |
Don't really know how to write this up in all honesty.
I made a mention about it but I don't imagine that's what you want. |
This includes: - match expression page - UnhandledMatchError page Co-authored-by: Larry Garfield <larry@garfieldtech.com>
Similarly to a <literal>switch</literal> statement, a | ||
<literal>match</literal> expression has a subject expression that is | ||
compared against multiple alternatives. Unlike <literal>switch</literal>, | ||
it will evaluate to a value much like ternary expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will evaluate to a value much like ternary expressions | |
it will evaluate to a value much like ternary expressions. |
</listitem> | ||
<listitem> | ||
<simpara> | ||
<literal>Match</literal> arms do not fallthrough compared to switch cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<literal>Match</literal> arms do not fallthrough compared to switch cases. | |
<literal>Match</literal> arms do not fall-through to later cases the way <literal>switch</literal> statements do. |
This is a W.I.P. any helped appreciated, especially @iluuu1994 for reviewing.
I'm struggling to describe some of the features and how to go about it, some of the terminology is copied from the Rust documentation: https://doc.rust-lang.org/reference/expressions/match-expr.html