Skip to content

Instantly share code, notes, and snippets.

@eribeiro
Last active December 29, 2015 16:49
Show Gist options
  • Save eribeiro/7699970 to your computer and use it in GitHub Desktop.
Save eribeiro/7699970 to your computer and use it in GitHub Desktop.
def wtf(v: Option[Int]) = v match {
case None => print("")
case Some(x) if x % 2 == 0 => print("Even#")
case _ => print("Odd#")
}
// test
(1 to 10).map(x=> Some(x)).foreach(wtf(_))
List(None, None, None, Some(2), None, None).foreach(wtf(_))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment