Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/Function0

Function0

scala.Function0
traitFunction0[+R] extendsAnyRef

A function of 0 parameters.

In the following example, the definition ofgreeting is shorthand, conceptually, for the anonymous class definitionanonfun0, 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
Function0.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Known subtypes
Self type
()=>R

Members list

Value members

Abstract methods

defapply():R

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
Function0.scala

Concrete methods

overridedeftoString():String

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
Function0.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp