exercism/elixir/name-badge/lib/name_badge.ex

11 lines
224 B
Elixir
Raw Normal View History

2023-12-18 20:02:33 +00:00
defmodule NameBadge do
def print(id, name, department) do
d = if department, do: String.upcase(department), else: "OWNER"
if id do
"[#{id}] - #{name} - #{d}"
else
"#{name} - #{d}"
end
end
end