[erlang-questions] Help for a newbie...
Boris Barvish
bbarvish@REDACTED
Wed May 8 15:28:42 CEST 2013
I have just started on my Erlang journey and am struggling with a compiler
error that I am hoping someone with experience can spent 5 secs and tell me
what i'm doing wrong, as I am not very good at understanding what the
compiler is telling me. Thanks!
I am passing in a string such as "morning, 1, 2, 3" as the UserEntry and
simply want to create a variable which holds a list of the tokens. I am
getting a message from the compiler saying "syntax error before: 'case'.
-module(practicum).
-export([placeorder/1]).
placeorder(UserEntry) ->
AllTokens = string:tokens(UserEntry, ",").
case hd(AllTokens) of
"morning" ->
processMorning(lists:nthtail(AllTokens,2));
"night" ->
processEvening(lists:nthtail(AllTokens,2));
_ -> io:fwrite("error\n")
end.
processMorning(Dishes) ->
Dishes.
processEvening(Dishes) ->
Dishes.
--
A designer knows he has achieved perfection not when there is nothing left
to add, but when there is nothing left to take away. Antoine de
Saint-Exupery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130508/2f4e7c25/attachment.htm>
More information about the erlang-questions
mailing list