Forked from sudowork/erlang-case-expression.erl
Last active
December 15, 2015 10:39
-
-
Save yangsu/5247321 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
// Basic `case` usage | |
val animal = "dog" | |
animal match { | |
case "dog" => "imadog" | |
case "cat" => "imacat" | |
case _ => "whatami" | |
} | |
// Pattern Matching with `case` | |
val DurhamWeather = ("cloudy", "durham") | |
val IsCloudy = DurhamWeather match { | |
case ("cloudy", _) => true | |
case _ => false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment