Skip to content

Instantly share code, notes, and snippets.

@sofoklis
Created January 17, 2013 14:19
Show Gist options
  • Save sofoklis/4556227 to your computer and use it in GitHub Desktop.
Save sofoklis/4556227 to your computer and use it in GitHub Desktop.
simple option
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