匿名函数可以说是没有名字的函数
package run
object fun {
def main(args: Array[String]): Unit = {
sayHello("world")
}
val sayHello = (str:String) =>{
print(s"hello $str")
}
}
scala> sayHello("world")
hello world
匿名函数可以说是没有名字的函数
package run
object fun {
def main(args: Array[String]): Unit = {
sayHello("world")
}
val sayHello = (str:String) =>{
print(s"hello $str")
}
}
scala> sayHello("world")
hello world
本文标题:scala匿名函数
本文链接:https://www.haomeiwen.com/subject/vodapqtx.html
网友评论