Private Functions
The defp macro defines a private function—one that can be called only within the module that declares it.
You can define private functions with multiple heads, just as you can with def. However, you cannot have some heads private and others public. That is, the following code is not valid:
| def fun(a) when is_list(a), do: true |
| defp fun(a), do: false |
Get Programming Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.