concept clause in category erlang

appears as: clauses, clauses, clause, clause
Erlang and OTP in Action

This is an excerpt from Manning's book Erlang and OTP in Action.

Next, we look at where pattern matching comes in. In Erlang, a function can consist of more than one clause. Whereas the example in the previous section had a single clause, the following example has three clauses:

If you, for instance, call my_module:area({square, 5}), you should get 25. If you pass it {rectangle, 3, 4}, it returns 12, and so on. Pattern matching decides which clause will be selected, but it also binds the variables to the elements of the data structure so that you can refer to these values in the body of each clause. Note that as opposed to the earlier either_or_both function, the order of the clauses in this function doesn’t matter, because only one can match at any time; they’re mutually exclusive.