diff options
author | Divay Prakash <divayprakash@users.noreply.github.com> | 2018-10-08 23:14:54 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 23:14:54 +0530 |
commit | 7b77c764509812ff8505c783b727ff1addab63ec (patch) | |
tree | 2d9709f2b7ac7939fa70e670fd42ce4a570827dd /elixir.html.markdown | |
parent | 2c7c608d8c3b1e1a7fee5296e763b20388369f58 (diff) | |
parent | b230fbd52f2f1e657fd5ca384f88b0f1959d5809 (diff) |
Merge pull request #3270 from chriszimmerman/GH-2594-elixir-clauses
[Elixir/en] - #2594 - Adds clarification for functions with multiple clauses.
Diffstat (limited to 'elixir.html.markdown')
-rw-r--r-- | elixir.html.markdown | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/elixir.html.markdown b/elixir.html.markdown index a74baa38..e82509e7 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -287,7 +287,11 @@ end PrivateMath.sum(1, 2) #=> 3 # PrivateMath.do_sum(1, 2) #=> ** (UndefinedFunctionError) -# Function declarations also support guards and multiple clauses: +# Function declarations also support guards and multiple clauses. +# When a function with multiple clauses is called, the first function +# that satisfies the clause will be invoked. +# Example: invoking area({:circle, 3}) will call the second area +# function defined below, not the first: defmodule Geometry do def area({:rectangle, w, h}) do w * h |