Money.add-exclamation-mark
You're seeing just the function
add-exclamation-mark
, go back to Money module for more information.
Specs
Add two Money
values and raise on error.
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.add! Money.new(:USD, 200), Money.new(:USD, 100)
#Money<:USD, 300>
Money.add! Money.new(:USD, 200), Money.new(:CAD, 500)
** (ArgumentError) Cannot add two %Money{} with different currencies. Received :USD and :CAD.