Skip to content

Instantly share code, notes, and snippets.

@jakubjanecek
Created February 10, 2013 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakubjanecek/4749637 to your computer and use it in GitHub Desktop.
Save jakubjanecek/4749637 to your computer and use it in GitHub Desktop.
String value = getValueFromDb("key") // possibly null
if (value != null) {
// continue
}
val value: Option[String] = getValueFromDb("key")
if (value != None) {
// continue
}
value match {
case Some(v) => // continue
case None => // null case
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment