E-Lite 2010: Erlang Behaviours
Nov 7, 2010
Intro to Erlang: Format a Date and Time (Cont.)
 % Function serving as a hashtable
 weekday(1) -> "Monday";
 weekday(2) -> "Tuesday";
 weekday(3) -> "Wednesday";
 weekday(4) -> "Thursday";
 weekday(5) -> "Friday";
 weekday(6) -> "Saturday";
 weekday(7) -> "Sunday".

% Using direct access on a tuple
 month(Num) ->
   element(Num, ?MONTH_NAMES).