Skip to main content

subtract (-)

Use - to negate a value or to subtract oper2 from oper1.

Basic syntax

To negate value, use the following syntax:

(- value)

To subtract oper2 from oper1, use the following syntax:

(- oper1 oper2)

Arguments

Use the following arguments to specify the values for negation or subtraction using the - Pact function.

ArgumentTypeDescription
valueinteger or decimalSpecifies the value to be negated.
oper1integer or decimalSpecifies the value to be subtracted from.
oper2integer or decimalSpecifies the value to subtract from oper1.

Return value

The - function returns the negation of the specified value, or the result of subtracting oper2 from oper1.

Examples

The following example demonstrates how to use the - function to negate a value in a Pact REPL:

pact> (- 1.0)
-1.0

The following example demonstrates how to use the - function to subtract integer values in a Pact REPL:

pact> (- 3 2)
1
We use cookies to enhance your experience. By continuing to browse, you consent to our use of analytics cookies.