Skip to content

Instantly share code, notes, and snippets.

@dcsobral
Created November 10, 2011 22:05
Show Gist options
  • Select an option

  • Save dcsobral/1356392 to your computer and use it in GitHub Desktop.

Select an option

Save dcsobral/1356392 to your computer and use it in GitHub Desktop.
scala> def f(x: Any) = x match {
| case y: Double => println("Got a Double: "+x)
| case _ => println("Whatever")
| }
f: (x: Any)Unit
scala> f(true)
Whatever
scala> f(1)
Whatever
scala> f(1.0)
Got a Double: 1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment