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

feat: ✨ add examples of record pattern matching #88

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

xxKeefer
Copy link
Contributor

@xxKeefer xxKeefer commented Apr 24, 2024

close #56 by adding examples of record destructuring to the tour

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Wonderful, thank you.

There's no such thing as destructuring in Gleam, that's a JavaScript term. In Gleam we pattern match.

Pattern matching has already been explained, so we don't need to explain what it is, but we do want to explain that:

  1. let can only be used with single variant custom types
  2. Labels can be used
  3. The .. spread operator can be used to match on only a portion of the fields.

It might be good to show _ but I don't think we need to explain it as it has been covered by previous lessons.

@xxKeefer
Copy link
Contributor Author

thanks for the feedback @lpil hopefully this is looking better 👍🏻

@xxKeefer xxKeefer changed the title feat: ✨ add examples of record destructuring feat: ✨ add examples of record pattern matching Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No example of record destructuring in a let assignment
2 participants