Money.sub-exclamation-mark
You're seeing just the function
sub-exclamation-mark
, go back to Money module for more information.
Specs
Subtract one Money
value struct from another and raise on error.
Returns either {:ok, money}
or {:error, reason}
.
Arguments
money_1
andmoney_2
are any validMoney.t
types returned byMoney.new/2
Returns
a
Money.t
struct orraises an exception
Examples
iex> Money.sub! Money.new(:USD, 200), Money.new(:USD, 100)
#Money<:USD, 100>
Money.sub! Money.new(:USD, 200), Money.new(:CAD, 500)
** (ArgumentError) Cannot subtract monies with different currencies. Received :USD and :CAD.