Function0 (original) (raw)
scala.Function0
A function of 0 parameters.
In the following example, the definition of greeting
is shorthand, conceptually, for the anonymous class definition anonfun0
, although the implementation details of how the function value is constructed may differ:
object Main extends App {
val name = "world"
val greeting = () => s"hello, $name"
val anonfun0 = new Function0[String] {
def apply(): String = s"hello, $name"
}
assert(greeting() == anonfun0())
}
Attributes
Source
Graph
Supertypes
Known subtypes
Self type
Members list
Apply the body of this function to the arguments.
Apply the body of this function to the arguments.
Attributes
Returns
the result of function application.
Source
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
Returns
a string representation of the object.
Definition Classes
Source
In this article