Skip to content

Commit e1eaea1

Browse files
committed
fix several places according to satansk and sadhen's suggestions
1 parent d2d8574 commit e1eaea1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_zh-cn/tour/tuples.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ val ingredient = ("Sugar" , 25):Tuple2[String, Int]
3030
Scala 中的元组包含一系列类:Tuple2,Tuple3等,直到 Tuple22。
3131
因此,当我们创建一个包含 n 个元素(n 位于 2 和 22 之间)的元组时,Scala 基本上就是从上述的一组类中实例化
3232
一个相对应的类,使用组成元素的类型进行参数化。
33-
上例中,`ingredient` 的类型为 Tuple2[String, Int]
33+
上例中,`ingredient` 的类型为 `Tuple2[String, Int]`
3434

35-
## 访问元组中的元素
35+
## 访问元素
3636

3737
使用下划线语法来访问元组中的元素。
3838
'tuple._n' 取出了第 n 个元素(假设有足够多元素)。
@@ -79,7 +79,7 @@ planetDistanceFromSun.foreach{ tuple => {
7979
}
8080
```
8181

82-
或者,在 'for' 循环推导中
82+
或者,在 'for' 推导中
8383

8484
```tut
8585
val numPairs = List((2, 5), (3, -7), (20, 56))
@@ -91,6 +91,6 @@ for ((a, b) <- numPairs) {
9191
}
9292
```
9393

94-
类型 Unit 的值 () 在概念上与类型 Tuple0 的值 () 相同。 这种类型只能有一个值,因为它没有元素。
94+
类型 `Unit` 的值 `()` 在概念上与类型 `Tuple0` 的值 `()` 相同。 `Tuple0` 只能有一个值,因为它没有元素。
9595

9696
用户有时可能在元组和案例类之间难以选择。 通常,如果元素具有更多含义,则首选案例类。

0 commit comments

Comments
 (0)