Does anybody have tips for golfing in Erlang? I'm looking for specific things that can be applied to Erlang, not any language. I know we already have tips for Elixir, but that is different.

As usual, please post separate tips in separate answers.


1 Answer 1


Use the ending conditions

Suppose you have a function reversing a list:


Since this is the only condition left, this can be golfed into:


Or, since this is an identity function:


You can also abuse the wild-cards in if statements. E.g.

if A<B->A;true->B end.

This can be golfed into:

if A<B->A;_->B end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.