SoftBank.Cldr.Money.sub

You're seeing just the function sub, go back to SoftBank.Cldr.Money module for more information.

Specs

sub(money_1 :: Money.t(), money_2 :: Money.t()) ::
  {:ok, Money.t()} | {:error, {module(), String.t()}}

Subtract one Money value struct from another.

Options

  • money_1 and money_2 are any valid Money.t types returned by Money.new/2

Returns

  • {:ok, money} or

  • {:error, reason}

Example

iex> SoftBank.Cldr.Money.sub Money.new(:USD, 200), Money.new(:USD, 100)
{:ok, Money.new(:USD, 100)}