Skip to content

Commit

Permalink
Article 2: tuples and lists
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed Sep 18, 2012
1 parent 3d621bd commit 653bf7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions head_tail.erl
@@ -0,0 +1,6 @@
#!/usr/bin/escript
head([]) -> throw( error);
head([Element | _Tail]) -> Element.

main(_) -> io:format("Head of [1]: ~p~n", [head([1])]),
io:format("Head of [1, 2]: ~p~n", [head([1, 2])]).

0 comments on commit 653bf7e

Please sign in to comment.