A Tour of Scala: Anonymous Function Syntax | The Scala Programming Language
It is also possible to define functions with multiple parameters:
(x: Int, y: Int) => "(" + x + ", " + y + ")"
or with no parameter:
() => { System.getProperty("user.dir") } There is also a very lightweight way to write function types. Here are the types of the three functions defined above:
Int => Int (Int, Int) => String () => String
Read full article from A Tour of Scala: Anonymous Function Syntax | The Scala Programming Language
No comments:
Post a Comment