Last active
March 29, 2020 00:31
-
-
Save yowchun93/5a86b11bcaf16da8dce9b65b1af69c84 to your computer and use it in GitHub Desktop.
Function clauses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Servy.Handler do | |
def route(conv) do | |
if conv.path == '/wildthings' do | |
%{ conv | resp_body: "Bears, Lions, Tigers"} | |
else | |
%{ conv | r esp_body: "Bears"} | |
end | |
end | |
end | |
# Refactor | |
def route(conv = %{path: "/wildthings"}) do | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment