Last active
December 27, 2015 03:29
-
-
Save knewter/7260284 to your computer and use it in GitHub Desktop.
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 PersonPrinter do | |
def say_hello(Person[first_name: first, last_name: "Dudington"]) do | |
"hey it's my brother, #{first}!" | |
end | |
def say_hello(Person[first_name: first]) do | |
"hello, #{first}" | |
end | |
def say_hello(person=Person[last_name: "Dudington"]) do | |
"hey #{person.first_name}" | |
end | |
end | |
bro = Person.new first_name: "Bro", last_name: "Dudington" | |
stranger = Person.new first_name: "Stranger", last_name: "von Strangehands" | |
PersonPrinter.say_hello(bro) | |
PersonPrinter.say_hello(stranger) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment