Rename function. format_result() -> inspirational_quote()
This commit is contained in:
@@ -79,13 +79,13 @@ defmodule Functions do
|
|||||||
end
|
end
|
||||||
|
|
||||||
koan "You can use pattern matching to define multiple cases for anonymous functions" do
|
koan "You can use pattern matching to define multiple cases for anonymous functions" do
|
||||||
format_result = fn
|
inspirational_quote = fn
|
||||||
{:ok, result} -> "Success is #{result}"
|
{:ok, result} -> "Success is #{result}"
|
||||||
{:error, reason} -> "You just lost #{reason}"
|
{:error, reason} -> "You just lost #{reason}"
|
||||||
end
|
end
|
||||||
|
|
||||||
assert format_result.({:ok, "no accident"}) == ___
|
assert inspirational_quote.({:ok, "no accident"}) == ___
|
||||||
assert format_result.({:error, "the game"}) == ___
|
assert inspirational_quote.({:error, "the game"}) == ___
|
||||||
end
|
end
|
||||||
|
|
||||||
def times_five_and_then(number, fun), do: fun.(number * 5)
|
def times_five_and_then(number, fun), do: fun.(number * 5)
|
||||||
|
|||||||
Reference in New Issue
Block a user