# divide_by function

Divide a variable by a value in place and return the new value.

## How to write it

### divide_by(name, x)

**name**

The variable to update. Takes a variable.

**x**

The divisor. Takes an expression.

## Examples

- $\displaystyle a := 4;\; \operatorname{divide\_by}(a, 2);\; a \; 2$

  `a := 4; divide_by(a, 2); a`

  In the solver, `a := 4; divide_by(a, 2); a` gives `2`.

  [Open in the solver](https://hilberon.com/?q=a%20%3A%3D%204%3B%20divide_by%28a%2C%202%29%3B%20a)

## Related functions

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

  Evaluate an expression even where it would be held.
- [decrement](https://hilberon.com/library/decrement)

  Subtract 1 from a variable in place and return its old value.
- [function](https://hilberon.com/library/function)

  A function with no name; also written x => body.
- [construct](https://hilberon.com/library/construct)

  Apply a head that is itself computed to arguments, as in f'(0) or (x => body)(a).
- [ifelse](https://hilberon.com/library/ifelse)

  A value chosen by a test.
- [add_to](https://hilberon.com/library/add_to)

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

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