Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created October 17, 2020 09:07
Show Gist options
  • Save ThaddeusJiang/9e487d4d5c1944e94fb136f1b7a21ad2 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/9e487d4d5c1944e94fb136f1b7a21ad2 to your computer and use it in GitHub Desktop.
defmodule Jstore do
@moduledoc """
Documentation for `Jstore`.
"""
@doc """
Hello world.
## Examples
iex> Jstore.total_price(:china_jzh, 100)
100
"""
def total_price(:china_jzh, price) do
if price >= 100 do
price
else
price + price * 0.03
end
end
def total_price(:china_others, price) do
price + price * 0.03
end
def total_price(:australia, price) do
price + price * 0.05 + price * 0.1
end
def total_price(:others_country, price) do
price + price * 0.07 + price * 0.17
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment