You can’t return early in elixir, but there’s another constuct for such operations:
cond do
a > b -> {:ok, "a"}
a < b -> {:ok, "b"}
a == b -> {:ok, "equal"}
end
You can’t return early in elixir, but there’s another constuct for such operations:
cond do
a > b -> {:ok, "a"}
a < b -> {:ok, "b"}
a == b -> {:ok, "equal"}
end