You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the old version of the book, it is mentioned that : can be used to give a value a new name under 4.15. I found this misleading because it is never mentioned that : is just a part of the pattern that can also be used for testing values.
For the new book, I think it would be good to use a more complex example of destructuring and explain its syntax. I would have found an example like in this blog post very useful for understanding the possible uses:
GuessState{answer:Answer::Bingo,guess: p, .. } => {// ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ ~~// | | | |// | | | Ignore remaining fields// | | |// | | Copy value of field `guess` into local variable `p`// | |// | Test that `answer field is equal to `Bingo`// |// Match against an instance of the struct `GuessState````
The text was updated successfully, but these errors were encountered:
@nodakai don't worry, @ledoge was just providing an example of what they were looking for. I found their example very helpful, and in the commit linked to this issue that I made before your comment, you'll see that we did not use the example with the ascii annotations.
In the old version of the book, it is mentioned that
:
can be used to give a value a new name under 4.15. I found this misleading because it is never mentioned that:
is just a part of the pattern that can also be used for testing values.For the new book, I think it would be good to use a more complex example of destructuring and explain its syntax. I would have found an example like in this blog post very useful for understanding the possible uses:
The text was updated successfully, but these errors were encountered: