# pre_increment function

Add 1 to a variable in place and return the new value.

## How to write it

### pre_increment(name)

**name**

The variable to update. Takes a variable.

## Examples

- $\displaystyle a := 1;\; \operatorname{pre\_increment}(a) \; 2$

  `a := 1; pre_increment(a)`

  In the solver, `a := 1; pre_increment(a)` gives `2`.

  [Open in the solver](https://hilberon.com/?q=a%20%3A%3D%201%3B%20pre_increment%28a%29)

## Related functions

- [pre_decrement](https://hilberon.com/library/pre_decrement)

  Subtract 1 from a variable in place and return the new value.
- [increment](https://hilberon.com/library/increment)

  Add 1 to a variable in place and return its old value.
- [release_hold](https://hilberon.com/library/release_hold)

  Evaluate an expression that was held.
- [set](https://hilberon.com/library/set)

  Assign a value to a name; also written name := value.
- [piecewise](https://hilberon.com/library/piecewise)

  Cases written value if condition, with an optional otherwise case.
- [set_delayed](https://hilberon.com/library/set_delayed)

  Define a function; also written f(x) := body.

---
Source: https://hilberon.com/library/pre_increment
