Created
January 17, 2013 14:19
-
-
Save sofoklis/4556227 to your computer and use it in GitHub Desktop.
simple option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val n = None //> n : None.type = None | |
val s = Some(1) //> s : Some[Int] = Some(1) | |
val o = Option(3) //> o : Option[Int] = Some(3) | |
o match { | |
case Some(x) => println("Count to :" + x) | |
case None => println("Dont count") | |
} //> Count to :3 | |
val s2 = Some(null) //> s2 : Some[Null] = Some(null) | |
val o2 = Option(null) //> o2 : Option[Null] = None | |
val s3 = Some() //> s3 : Some[Unit] = Some(()) | |
val o3 = Option() //> o3 : Option[Unit] = Some(()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment