Subtract()

Namespace ›› System ›› MfInteger ›› Methods ››
Parent Previous Next

Subtract()

OutputVar := instance.Subtract(value)

Subtract(value)

Subtracts MfInteger value from current instance of MfInteger.

Parameters

value

The value to subtract from the current instance.
Can be any type that matches IsIntegerNumber. or var integer.

Returns

If ReturnAsObject is true then returns current instance of MfInteger with an updated value; Otherwise returns var containing integer.

Throws

Throws MfNotSupportedException if Readonly is true.
Throws MfNullReferenceException if called as a static method
Throws MfArgumentNullException if value is null.
Throws MfArgumentException if value is not an instance of MfInteger and can not be converted into integer value.
Throws MfArgumentOutOfRangeException if adding value is less then MinValue and greater than MaxValue

Remarks

If value is a float or MfFloat instance then method will alway round down for positive number and round up for negative numbers. For instance 2.8 is converted to 2 and -2.8 is converted to -2.

Example

i := new MfInteger(10, true) ; create new MfInt64 and set it RetrunAsObject to value to true
i.Subtract(2) ; i.Value is now 8
iNew := new MfInteger(5)
MsgBox % i.Subtract(iNew).Value ; displays 3
Msgbox % i.Subtract(10).Value ; displays -7
MsgBox % i.Subtract(3).Subtract(10).Value ; displays -20