Money.sub

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

Specs

sub(money_1 :: t(), money_2 :: t()) ::
  {:ok, 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> Money.sub Money.new(:USD, 200), Money.new(:USD, 100)
{:ok, Money.new(:USD, 100)}