if and fun with erl

Yann SECQ yann.secq@REDACTED
Tue Feb 1 14:31:37 CET 2011


On 01/02/2011 14:26, Steve Strong wrote:
> You were close, tried *almost* every combination :) Try this:
>
> 13> Compare = fun(X, Y) ->
> if X>Y -> greater;
> X==Y -> equal;
> X<Y -> less
> end
> end.
>
> You need an "end" to the "if" and an "end" to the "fun". The first end
> doesn't need a comma after it since it is the last statement in the fun.

Thank you ! I tried several combinations but I miss this one as
I thought that I needed some punctuation at the end of each
expression :)

Thank again for your help (and reactivity !).

-- 
Yann.Secq{at}univ-lille1.fr | http://www.lifl.fr/~secq
Universite de Lille 1       | http://www.univ-lille1.fr
Ouverture & Independance    | http://www.ouverture-independance.fr
Appel des Appels            | http://lille.appeldesappels.fr

"Ne désespérez jamais. Faites infuser davantage.", Henri Michaux


More information about the erlang-questions mailing list