Last active
December 16, 2015 16:39
-
-
Save patrickgombert/5464619 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
anwer(foo, Args) -> % pattern match the arguments | |
answer_to_foo; % notice the semi-colon | |
answer(bar, Args) -> | |
case Delicious of | |
veggies -> | |
false; % Again, notice the semi colon | |
bacon -> % case is another form of pattern matching | |
true % The last statement in the case has no punctuation | |
end; | |
answer(baz, Args) -> | |
answer_to_baz. % The last match has the period | |
%%%%%%%%%%%%%%%%% | |
answer(ping, []) -> Return the atom pong | |
answer(pascal, [NthRow]) -> Return the nth row of pascal's | |
triangle as a list | |
answer(bowling, [FirstThrow, SecondThrow .. NthThrow]) -> | |
Return the score for a given | |
bowling game | |
answer(roman_numerals, [Number]) -> Return the roman numeral | |
for the given number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment