exercise-pattern-matching.erl 283 B

12345678910111213141516171819
  1. -module('exercise-pattern-matching').
  2. -export([maxThree/3, howManyEqual/3]).
  3. maxThree(A,B,C) ->
  4. max(A, max(B, C)).
  5. howManyEqual(A, A, A) ->
  6. 3;
  7. howManyEqual(A, A, _) ->
  8. 2;
  9. howManyEqual(A, _, A) ->
  10. 2;
  11. howManyEqual(_, A, A) ->
  12. 2;
  13. howManyEqual(_, _, _) ->
  14. 0.