Created
February 12, 2021 16:18
-
-
Save karlosmid/4c9642634fa0e9efd17c0ac39bb09725 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 Vat do | |
@moduledoc """ | |
Elixir In Action book example for function overloading | |
""" | |
def price(%{country: :germany, price: price}), do: 1.19 * price | |
def price(%{country: :greece, price: price}), do: 1.24 * price | |
def price(%{country: :croatia, price: price}), do: 1.25 * price | |
def price(unknown), do: {:unknown_country_data, unknown} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment