Created
February 2, 2015 13:24
-
-
Save shigemk2/3edbb599efe6ab91ed5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val i = 0 | |
// i is an integer | |
i match { | |
case 1 => println("January") | |
case 2 => println("February") | |
case 3 => println("March") | |
case 4 => println("April") | |
case 5 => println("May") | |
case 6 => println("June") | |
case 7 => println("July") | |
case 8 => println("August") | |
case 9 => println("September") | |
case 10 => println("October") | |
case 11 => println("November") | |
case 12 => println("December") | |
// catch the default with a variable so you can print it | |
case whoa => println("Unexpected case: " + whoa.toString) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment