Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 5-Erlang/matching_function.erl @ 73:74976fddd25f
Ignore Erlang binary files and remove existing ones
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 03 Feb 2018 19:52:45 +0000 |
parents | 32f018861e36 |
children |
line wrap: on
line source
-module(matching_function). -export([number/1]). % Like Prolog, we can define different function matches as "overrides" of the function % with the same name/parameter count but different "fixed" values % For some reason these are separated by semi-colons here number(one) -> 1; number(two) -> 2; number(three) -> 3. % Calling this with any value or atom other than one, two or three will fail.