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/Nothing

Nothing

scala.Nothing
final abstract openclassNothing

Nothing is - together withscala.Null - at the bottom of Scala's type hierarchy.

Nothing is a subtype of every other type (includingscala.Null); there existno instances of this type. Although typeNothing is uninhabited, it is nevertheless useful in several ways. For instance, the Scala library defines a valuescala.collection.immutable.Nil of typeList[Nothing]. Because lists are covariant in Scala, this makesscala.collection.immutable.Nil an instance ofList[T], for any element of typeT.

Another usage for Nothing is the return type for methods which never return normally. One example is method error inscala.sys, which always throws an exception.

Attributes

Graph
Supertypes
classAny
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp