20 ms·
or pattern match it: defmodule Guess do def guess_message(candidate, _count=0) do "There are no #{candidate}s" end def guess_mess
by joevandyk 2y ago
or pattern match it:
defmodule Guess do
def guess_message(candidate, _count=0) do
"There are no #{candidate}s"
end
def guess_message(candidate, _count=1) do
"There is 1 #{candidate}"
end
def guess_message(candidate, count) do
"There are #{count} #{candidate}s"
end
end