# pre_increment 函数

把变量原地加 1 并返回新值。

## 怎么写

### pre_increment(name)

**name**

要更新的变量。接受一个变量。

## 示例

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

  `a := 1; pre_increment(a)`

  在求解器中，`a := 1; pre_increment(a)` 的结果是 `2`。

  [在求解器中打开](https://zh.hilberon.com/?q=a%20%3A%3D%201%3B%20pre_increment%28a%29)

## 相关函数

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

  将变量就地减 1，并返回新值。
- [increment](https://zh.hilberon.com/library/increment)

  将变量原地加 1，并返回它的旧值。
- [release_hold](https://zh.hilberon.com/library/release_hold)

  对已保持的表达式求值。
- [set](https://zh.hilberon.com/library/set)

  给名称赋值；也可写作 name := value。
- [piecewise](https://zh.hilberon.com/library/piecewise)

  按条件写出的分段取值，写作 value if condition，并可带一个 otherwise 分支。
- [set_delayed](https://zh.hilberon.com/library/set_delayed)

  定义函数；也可写作 f(x) := body。

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