A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scala-lang.org/api/3.x/scala/Function1$$UnliftOps.html below:

UnliftOps

scala.Function1.UnliftOps

Members list

Converts an optional function to a partial function.

Converts an optional function to a partial function.

Attributes
Example

Unlike Function.unlift, this UnliftOps.unlift method can be used in extractors.

val of: Int => Option[String] = { i =>
  if (i == 2) {
    Some("matched by an optional function")
  } else {
    None
  }
}
util.Random.nextInt(4) match {
  case of.unlift(m) => // Convert an optional function to a pattern
    println(m)
  case _ =>
    println("Not matched")
}
Source
Function1.scala

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4