SoftBank.Cldr.Money.mult

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

Specs

mult(Money.t(), Cldr.Math.number_or_decimal()) ::
  {:ok, Money.t()} | {:error, {module(), String.t()}}

Multiply a Money value by a number.

Arguments

  • money is any valid Money.t type returned by Money.new/2

  • number is an integer, float or Decimal.t

Note that multipling one %:'Elixir.Money'{} by another is not supported.

Returns

  • {:ok, money} or

  • {:error, reason}

Example

iex> SoftBank.Cldr.Money.mult(Money.new(:USD, 200), 2)
{:ok, Money.new(:USD, 400)}

iex> SoftBank.Cldr.Money.mult(Money.new(:USD, 200), "xx")
{:error, {ArgumentError, "Cannot multiply money by \"xx\""}}