From b230fbd52f2f1e657fd5ca384f88b0f1959d5809 Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Mon, 8 Oct 2018 12:17:24 -0400 Subject: Adds clarification for functions with multiple clauses. --- elixir.html.markdown | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'elixir.html.markdown') 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 -- cgit v1.2.3 From 8ba2b7b32998125f29ee253715a82d353b9798d6 Mon Sep 17 00:00:00 2001 From: Harry Moreno Date: Thu, 27 Dec 2018 19:40:21 -0500 Subject: Fix broken link --- elixir.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elixir.html.markdown') diff --git a/elixir.html.markdown b/elixir.html.markdown index e82509e7..7af29202 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -452,7 +452,7 @@ Agent.update(my_agent, fn colors -> ["blue" | colors] end) ## References * [Getting started guide](http://elixir-lang.org/getting-started/introduction.html) from the [Elixir website](http://elixir-lang.org) -* [Elixir Documentation](http://elixir-lang.org/docs/master/) +* [Elixir Documentation](https://elixir-lang.org/docs.html) * ["Programming Elixir"](https://pragprog.com/book/elixir/programming-elixir) by Dave Thomas * [Elixir Cheat Sheet](http://media.pragprog.com/titles/elixir/ElixirCheat.pdf) * ["Learn You Some Erlang for Great Good!"](http://learnyousomeerlang.com/) by Fred Hebert -- cgit v1.2.3