Skip to content

Commit 2f77c8d

Browse files
authored
Update 20_Extensions.md (#1187)
1 parent 8f21fcf commit 2f77c8d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/02_language_guide/20_Extensions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ let memberwiseRect = Rect(origin: Point(x: 2.0, y: 2.0),
114114
size: Size(width: 5.0, height: 5.0))
115115
```
116116

117-
你可以通过扩展 `Rect` 结构体来提供一个允许指定 point 和 size 的构造器:
117+
你可以通过扩展 `Rect` 结构体来提供一个允许指定 center 和 size 的构造器:
118118

119119
```swift
120120
extension Rect {
@@ -184,7 +184,7 @@ someInt.square()
184184

185185
## 下标 {#subscripts}
186186

187-
扩展可以给现有的类型添加新的下标。下面的例子中,对 Swift 的 `Int` 类型添加了一个整数类型的下标。下标 `[n]` 从数字右侧开始,返回小数点后的第 `n`
187+
扩展可以给现有的类型添加新的下标。下面的例子中,对 Swift 的 `Int` 类型添加了一个整数类型的下标。下标 `[n]` 返回从数字右侧开始的第 `n` 位数字
188188

189189
- `123456789[0]` 返回 `9`
190190
- `123456789[1]` 返回 `8`
@@ -268,4 +268,4 @@ printIntegerKinds([3, 19, -27, 0, -6, 0, 7])
268268

269269
> 注意
270270
>
271-
> `number.kind` 已经被认为是 `Int.Kind` 类型。所以,在 `switch` 语句中所有的 `Int.Kind` case 分支可以被缩写,就像使用 `.negative` 替代 `Int.Kind.negative.`
271+
> `number.kind` 已经被认为是 `Int.Kind` 类型。所以,在 `switch` 语句中所有的 `Int.Kind` case 分支可以被缩写,例如使用 `.negative` 替代 `Int.Kind.negative.`

0 commit comments

Comments
 (0)