Created
March 25, 2016 02:40
-
-
Save joeljackson/3358b0204837f314f176 to your computer and use it in GitHub Desktop.
Practical function matching example
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
add_subscription(user, subscription) | |
def add_subscription(%User{subscription: nil}, subscription) do | |
#Add subscription here | |
end | |
def add_subscription(_user, _subscription) do | |
raise "This user already has a subscription" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment