4 points · by jrheard · 4y ago · 1 comment
I'm in awe every time I see how elegant this is in Erlang/Elixir:
case HTTPoison.get(url) do
{:ok, %HTTPoison.Response{body: body, status_code: 200}} ->
IO.puts body
{:error, %HTTPoison.Error{reason: reason}} ->
IO.inspect reason
end
Pattern matching on return tuples is really amazing.