MoneyArithmetic extension
Operators
-
operator +(Money other)
→ Money
-
Adds
other
money to this money and returns the result. Money objects
with differing currencies return an unavailable amount. Example:
var a = Money(5.00, NZD)
var b = Money(10.00, NZD)
var c = a + b // value of c is 15.00
-
operator -(Money other)
→ Money
-
Subtracts
other
money from this money and returns the result. Money
objects with differing currencies return an unavailable amount. Example:
var a = Money(5.00, NZD)
var b = Money(10.00, NZD)
var c = a - b // value of c is -5.00
-
operator <(Money other)
→ bool
-
Less than operator.
-
operator <=(Money other)
→ bool
-
Less than or equal operator.
-
operator >(Money other)
→ bool
-
Greater than operator.
-
operator >=(Money other)
→ bool
-
Greater than or equal operator.
-
operator unary-()
→ Money
-
Negates this object's amount and returns the result. Unavailable amounts
are returned unchanged. Example:
var a = Money(5.00, NZD)
var b = -a // value of b is -5.00