diff --git a/src/basic/match-pattern/all-patterns.md b/src/basic/match-pattern/all-patterns.md index d6fe6aa0..c591b4ec 100644 --- a/src/basic/match-pattern/all-patterns.md +++ b/src/basic/match-pattern/all-patterns.md @@ -160,9 +160,11 @@ fn main() { } ``` -首先是 `match` 第一个分支,指定匹配 `y` 为 `0` 的 `Point`; -然后第二个分支在第一个分支之后,匹配 `y` 不为 `0`,`x` 为 `0` 的 `Point`; -最后一个分支匹配 `x` 不为 `0`,`y` 也不为 `0` 的 `Point`。 +首先是 `match` 第一个分支,指定匹配 `y` 为 `0` 的 `Point { x, y: 0 }`; + +然后第二个分支,匹配 `y` 不为 `0`,`x` 为 `0` 的 `Point { x: 0, y }`; + +最后一个分支,匹配 `x` 不为 `0`,`y` 也不为 `0` 的 `Point { x, y }`。 在这个例子中,值 `p` 因为其 `x` 包含 0 而匹配第二个分支,因此会打印出 `On the y axis at 7`。