Skip to content

Instantly share code, notes, and snippets.

@yangsu
Forked from sudowork/erlang-case-expression.erl
Last active December 15, 2015 10:39
Show Gist options
  • Save yangsu/5247321 to your computer and use it in GitHub Desktop.
Save yangsu/5247321 to your computer and use it in GitHub Desktop.
// 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