You are viewing a single comment's thread. Return to all comments →
In Erlang you also can do it without 'abs':
lists:foldl(fun(E,Acc) -> if E rem 2 /= 0 -> Acc + E; true -> Acc end end, 0, List)
Seems like cookies are disabled on this browser, please enable them to open this website
Sum of Odd Elements
You are viewing a single comment's thread. Return to all comments →
In Erlang you also can do it without 'abs':