[erlang-questions] Comma, semicolon. Aaaaa
Ahmed Ali
ahmed.nawras@REDACTED
Sun Sep 16 12:55:39 CEST 2007
Hi Lone,
I'll try to give you my view on the syntax. The comma (,) is like (;) in
languages like Java/C. Each method is ended with a Dot (.). If you have more
than one method with the same number parameters (called arity in Erlang),
you need to separate them with (;). There is no similar construct in
Java/C for this.
Similarly, you can think of if/case statements, which use (;) to separate
different if/case conditions, (,) to separate clauses for each condition,
and (.) to indicate the end of if/case statement.
I hope this helps.
Best regards,
Ahmed Al-Issaei
On 9/15/07, Lone Wolf <hubaghdadi@REDACTED> wrote:
>
> Hi.
> Well guys, I'm struggling with Erlang syntax.
> Does Erlang has line terminators like C++ or Java?
> Consider this sinppet:
> ----------
> convert_list_to_c([{Name, {f, F}} | Rest]) ->
> Converted_City = {Name, {c, (F -32)* 5 / 9}},
> [Converted_City | convert_list_to_c(Rest)];
> ----------
> Why there is a comma after {Name, {c, (F -32)* 5 / 9}} ?
> Another snippet and the same question:
> ----------
> format_temps(List_of_cities) ->
> Converted_List = convert_list_to_c(List_of_cities),
> print_temp(Converted_List).
> ----------
> Another one:
> ----------
> foreach(Fun, [First|Rest]) ->
> Fun(First),
> foreach(Fun, Rest);
> ----------
> How to define blocks? using { } for example ? or by using indentation (aka
> Python) ?
> All these snippets are from Erlang docs.
> Thanks.
>
>
> *Deep into that darkness peering, long I stood there, wondering, fearing,
> Doubting, dreaming dreams no mortal ever dreamed before.*
> *E.A Poe*
> **
> **
>
> ------------------------------
> Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user
> panel<http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7+>and lay it on us.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070916/4bb6769e/attachment.htm>
More information about the erlang-questions
mailing list