Skip to content

Commit 5e5b229

Browse files
committed
Fix Chinese Simple(zh_CN) version of issue#1339, which is refining pattern matching.
1 parent cffdaea commit 5e5b229

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_zh-cn/tour/pattern-matching.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ x match {
2828
case 0 => "zero"
2929
case 1 => "one"
3030
case 2 => "two"
31-
case _ => "many"
31+
case _ => "other"
3232
}
3333
```
34-
上述代码中的`val x`是一个0到10之间的随机整数,将它放在`match`运算符的左侧对其进行模式匹配,`match`的右侧是包含4条`case`的表达式,其中最后一个`case _`表示匹配其余所有情况,在这里即是`x`大于2的情况
34+
上述代码中的`val x`是一个0到10之间的随机整数,将它放在`match`运算符的左侧对其进行模式匹配,`match`的右侧是包含4条`case`的表达式,其中最后一个`case _`表示匹配其余所有情况,在这里就是其他可能的整型值
3535

3636
`match`表达式具有一个结果值
3737
```tut
3838
def matchTest(x: Int): String = x match {
3939
case 1 => "one"
4040
case 2 => "two"
41-
case _ => "many"
41+
case _ => "other"
4242
}
43-
matchTest(3) // many
43+
matchTest(3) // other
4444
matchTest(1) // one
4545
```
4646
这个`match`表达式是String类型的,因为所有的情况(case)均返回String,所以`matchTest`函数的返回值是String类型。

0 commit comments

Comments
 (0)