Created
March 26, 2013 09:15
-
-
Save sudowork/5244080 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 | |
Animal = "dog". | |
case Animal of | |
"dog" -> imadog; | |
"cat" -> imacat; | |
_ -> whatami % underscore is again wildcard | |
end. | |
% Pattern Matching with `case` | |
DurhamWeather = {cloudy, durham}. | |
IsCloudy = case DurhamWeather of | |
{cloudy, _} -> true; | |
_ -> false | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment