[▶️ Video: anatomy of the Decrement block](https://celestory-docs-videos.netlify.app/en/anatomie-bloc/decrement.html)


![Decrement](https://celestory-docs-illustrations.netlify.app/en/Decrement_EN.svg)

The Decrement block allows you to subtract a precise value from a Number type variable, providing a convenient shortcut for operations like removing life points, decreasing a counter or adjusting a balance without manual calculation.

This block simplifies arithmetic operations by automating subtraction (variable = variable - value), thus avoiding errors and speeding up flow design.

## 📥 Entries

- variable (Number): The targeted numeric variable, previously defined in the project. When it is chosen in the editing window and nothing is wired to `variable` or `value`, the block is drawn compact as « variable - value » with only `in` and `out`: the variable and the value are then set in the editing window.
- value (Number): The number to subtract from the variable (default: 1).

## 📤 Outings

- out (Stream): The output flow that activates after the decrement is successful.

## 💡 Example of use

Scenario: Management of life points in a game

1. The player takes damage after an enemy attack.
1. The system checks that the life points (player_pv) are greater than 0.
1. The Decrement block is called with:

- variable = player_pv (current value: 30).
- value = 5 (damage inflicted).

1. The player_pv variable changes to 25.
1. The output stream (out) triggers a check to display a message ("Damage taken!") or activate a visual effect.

## ⚙️ Technical Details

- Behavior: The decrement is immediate and directly modifies the target variable. No type validation is performed (make sure variable is of type Number).
- Default value: If value is not specified, the subtraction is 1.

---

*Documented version: v1*
