1: -module(play).
2: -export([headstrip/1]).
3:
4: headstrip([]) -> ok;
5: headstrip([Head|Rest]) when Head > 4 ->
6: io:format("~w bingo!~n", [Head]),
7: headstrip(Rest);
8: headstrip([Head|Rest]) ->
9: io:format("~w~n",[Head]),
10: headstrip(Rest).
3> play:headstrip([1,2,3,4,5,6,7,8,9]). 1 2 2 3 4 5 bingo! 6 bingo! 7 bingo! 8 bingo! 9 bingo! ok
No comments:
Post a Comment