val name = "Gwf"
println(s"hello $name")
val str =
"""
|这是一个多行字符串
|看到了吗
""".stripMargin
println(str)
// 直接定义
scala> (x:Int) => x+1
res19: Int => Int = <function1>
// 赋值给变量
scala> val m1 = (x:Int) => x+1
m1: Int => Int = <function1>
scala> m1(10)
res20: Int = 11
// 赋值给函数
scala> def add = (x:Int,y:Int)=>{x+y}
add: (Int, Int) => Int
scala> add(2,3)
res21: Int = 5
def sum(a:Int,b:Int)= a+b
println(sum(1,2))
// 将原来接收两个参数的一个函数,转换成2个
def sum2(a:Int)(b:Int) = a+b
println(sum2(1)(2))