Skip to content

Instantly share code, notes, and snippets.

@nicholasren
Created May 19, 2014 15:32
Show Gist options
  • Save nicholasren/ddecb1b30578565dd938 to your computer and use it in GitHub Desktop.
Save nicholasren/ddecb1b30578565dd938 to your computer and use it in GitHub Desktop.
scala training example - pattern matching
case class Option[T]
case class Some(t: T) extends Option[T]
case class None extends Option[T]
val possibleNumber = Some(1)
val numbers = possibleNumber match {
case Some(x) => x
case None => 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment