blob: ee5e8071518ed83f8a497bdade1933796feb6c0e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
object testSome {
val x: Option[String] = Some("foo")
val x1: Option[Int] = Some(3)
val y: Option[String] = None
val y1: Option[Int] = None
Console.println(x.isEmpty) // x ne null
Console.println(x1.isEmpty)
Console.println(x.get) // x
Console.println(x1.get)
def f(x:String) = Some(x)
x.flatMap(&f)
}
|