[erlang-questions] Inline If

Zoltan Lajos Kis <>
Sun May 9 00:25:16 CEST 2010


On 5/9/2010 12:00 AM, Henning Diedrich wrote:
> Is there a common Erlang way to do stuff like C++:
>
>    a ? b : c;
>
> The list comprehension
>
>    [X || X <- [B,C], A ]
>
> ?
>
> Thanks,
> Henning
>

You can define a function or macro for this purpose; see "assert" 
discussed in this thread: Ternary operator used as assert
http://www.erlang.org/cgi-bin/ezmlm-cgi?4:sss:48575:200912:jchpnnbpampjdbbfpigm

Regards,
Zoltan.


More information about the erlang-questions mailing list