A function of 0 parameters.
In the following example, the definition of javaVersion is a shorthand for the anonymous class definition anonfun0:
object Main extends App {
val javaVersion = () => sys.props("java.version")
val anonfun0 = new Function0[String] {
def apply(): String = sys.props("java.version")
}
assert(javaVersion() == anonfun0())
}
| Supertypes | |
|---|---|
| Known subtypes | 20 types |
| Self type |
Apply the body of this function to the arguments.
| Returns | the result of function application. |
|---|
Returns a string representation of the object.
The default representation is platform dependent.
| Returns | a string representation of the object. |
|---|---|
| Definition Classes | Any |
© 2002-2022 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://scala-lang.org/api/3.2.0/scala/Function0.html