scala> PartialFunction.condOpt(5) { case x if true => x }
res9: Option[Int] = Some(5)
scala> PartialFunction.condOpt(5) { case x if false => x }
res10: Option[Int] = None
Here, the guard holds the condition and the value passed to condOpt
is the value returned if the guard evaluates to true.