Skip to content

Instantly share code, notes, and snippets.

@karlosmid
Created February 12, 2021 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlosmid/7797bb3583b8192e11319842063b7024 to your computer and use it in GitHub Desktop.
Save karlosmid/7797bb3583b8192e11319842063b7024 to your computer and use it in GitHub Desktop.
Example for Elixir function overloading
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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment