[erlang-questions] Comma, semicolon. Aaaaa
Tue Sep 18 03:05:44 CEST 2007
>> >>C: x > y ? e1, e2 : (e3, e4)
>> Erlang: if x > y -> e1, e2 ; true -> e3, e4 end
>> I didn't understand this example.
>> Sorry guys but I didn't know anything in C language.
>> Thanks for help.
> (if (> x y) '(e1 e2) '(e3 e4))
Not quite. that would look like
if x>y -> [e1, e2]; true -> [e3,e4] end.
A=if x>y ->
Is just to show that 'if' returns a value, and it returns the return-
value of the last statement in the clause (a section of the 'if' that
begins with "EXPRESSION ->") of the 'if' expression that is
evaluated. The semicolons separate those clauses. That particular
expression binds A=e4.
More information about the erlang-questions