Skip to content

Commit 22e34da

Browse files
author
Ye Chen
committed
translation fix for _ replace parameter
1 parent 578bcf6 commit 22e34da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_zh-cn/tour/higher-order-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ val newSalaries = salaries.map(x => x * 2) // List(40000, 140000, 80000)
3636
val salaries = Seq(20000, 70000, 40000)
3737
val newSalaries = salaries.map(_ * 2)
3838
```
39-
既然Scala编译器已经知道了参数的类型(一个单独的Int),你可以只给出函数的右半部分,不过需要使用`_`来替代唯一的参数名(在上一个例子中是`x`
39+
既然Scala编译器已经知道了参数的类型(一个单独的Int),你可以只给出函数的右半部分,不过需要使用`_`代替参数名(在上一个例子中是`x`
4040

4141
## 强制转换方法为函数
4242
你同样可以传入一个对象方法作为高阶函数的参数,这是因为Scala编译器会将方法强制转换为一个函数。

0 commit comments

Comments
 (0)