feat:ChatGPT第 6 课:占位符 _、参数类型推断、匿名函数简写。

This commit is contained in:
2026-09-13 22:49:11 +08:00
parent e481ad1424
commit a019745c81
7 changed files with 180 additions and 0 deletions
@@ -0,0 +1,21 @@
package practise6.exercises
/*
练习 4
把:
val add: (Int, Int) => Int = (a, b) => a + b
改成 _。
要求:
println(add(10, 20))
输出:
30
*/
object Exercises4 {
def main(args: Array[String]): Unit = {
val add: (Int, Int) => Int = _ + _
println(add(10, 20))
}
}