Let's say I have two options for using a function. Do something with users who have a subscription, and something with users who don't have a subscription.
def add_subscription(subscription_id, %User{subscription: nil})
AND
def add_subscription(subscription_id, user)
How do I perform pattern matching like this, and also use the user in the first function?
Thank!
source
share