Update all-patterns.md

更正 `;` 
修改一下章节 #### 解构结构体 中对于分支含义的解释。原文中 第二个分支“在第一个分支之后” 感觉描述重复了,简化一下。
增加换行,看起来会更清晰一下。
增加 `Point { x, y }` 部分,更好对比每一个分支的内容。
pull/1078/head
Kirin 3 years ago committed by GitHub
parent 212526cd31
commit 63527993b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -160,9 +160,11 @@ fn main() {
} }
``` ```
首先是 `match` 第一个分支,指定匹配 `y``0``Point` 首先是 `match` 第一个分支,指定匹配 `y``0``Point { x, y: 0 }`;
然后第二个分支在第一个分支之后,匹配 `y` 不为 `0``x` 为 `0``Point`;
最后一个分支匹配 `x` 不为 `0``y` 也不为 `0``Point` 然后第二个分支,匹配 `y` 不为 `0``x` 为 `0``Point { x: 0, y }`;
最后一个分支,匹配 `x` 不为 `0``y` 也不为 `0``Point { x, y }`
在这个例子中,值 `p` 因为其 `x` 包含 0 而匹配第二个分支,因此会打印出 `On the y axis at 7` 在这个例子中,值 `p` 因为其 `x` 包含 0 而匹配第二个分支,因此会打印出 `On the y axis at 7`

Loading…
Cancel
Save