diff options
author | M. Peter <mpneuried@googlemail.com> | 2019-12-24 11:19:25 +0100 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2019-12-24 11:19:25 +0100 |
commit | 04c9c244f1040a5fee5997eb2b04bada2d028096 (patch) | |
tree | 6c658f95d29c639129cb274549661471d5947af1 | |
parent | 00abb3b6e3bdd5e2da533ed796b7a5bacd0d65cb (diff) | |
download | elixir-04c9c244f1040a5fee5997eb2b04bada2d028096.tar.gz |
Update enum.ex docs for find_value (#9641)
-rw-r--r-- | lib/elixir/lib/enum.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 7cf155019..e7215a545 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -996,8 +996,16 @@ defmodule Enum do Similar to `find/3`, but returns the value of the function invocation instead of the element itself. + The return value is considered to be found when the result is truthy + (neither `nil` nor `false`). + ## Examples + iex> Enum.find_value([2, 3, 4], fn x -> + ...> if x > 2, do: x * x + ...> end) + 9 + iex> Enum.find_value([2, 4, 6], fn x -> rem(x, 2) == 1 end) nil |