# Subtract Variable

**Subtract Variable** node is designed to perform subtraction operations on a specified variable and store the result back in the same variable. This node is useful for decreasing values or calculating differences within your workflow.

### Properties Panel

<table data-header-hidden><thead><tr><th width="165"></th><th width="380"></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td><td><strong>Required</strong></td></tr><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3">Node Name</a></td><td>true</td></tr><tr><td>Variable Name</td><td>The name of the variable from which the value will be subtracted.</td><td>true</td></tr><tr><td>Value</td><td>The value to subtract from the variable.</td><td>true</td></tr></tbody></table>

### Usage

1. Specify the name of the variable from which you want to subtract.
2. Enter the subtrahend (the value to be subtracted from the variable).

### Behaviour

* The node will retrieve the current value of the specified variable.
* It will then subtract the provided value from this variable.
* The result of the subtraction will be stored back in the same variable, overwriting its previous value.
* If the variable doesn't exist, it'll raise an error.

### Returns

The node updates the value of the specified variable with the result of the subtraction. You can access this updated value using Magical Autocomplete (e.g., `$.variables.<variable_name>`) in any node below this node.

### Example

Let's say you want to apply a $5 discount to a `price`. You already have a variable `price`:

1. Set Variable name to `$.variables.price`
2. Set Value to `5`

If it exists and `price` was `20`, it will now be `15`.

### Best Practices

* Ensure that the variable you're subtracting from contains a numeric value to avoid type conversion errors.
* Be aware of the order of subtraction. This node subtracts the provided value from the variable, not the other way around.
* Ensure that the variable is initialized earlier


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cosmocloud.io/flow-builder/node-types/variable-nodes/mathematical/subtract-variable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
