Subtract
Description
Pure function returning a minus b.
When to use
Use Subtract to compute a difference between two numbers, such as how many items remain after a deduction or how far a value is from a target. Both integer and decimal inputs are accepted. For the special case of flipping a sign rather than subtracting a variable, Negate is more direct. To keep the result within a valid range after subtraction, chain the output into Clamp.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| A | generic(integer, decimal) | 0 | The minuend. |
| B | generic(integer, decimal) | 0 | The subtrahend. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Result | generic(integer, decimal) | The difference a minus b. |
Example
Calculate remaining capacity after reserving some slots. Wire the total slot count into
the A input of Subtract and the reserved count into the B input. Feed the Result output
into the A input of Greater than? with B set to 0, then connect the Result output to
the Condition input of Branch to check whether any capacity remains before proceeding.