# clone() Function & Examples

Use the clone() utils function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## clone

#### clone(x)

Try it yourself:

```calculio
clone(3.5)
clone(2 - 4i)
clone(45 deg)
clone([1, 2; 3, 4])
clone("hello world")
```

---

## clone(): make an independent copy

**clone(x)** creates a copy of a value. It is most useful with arrays, matrices, and other mutable data where later changes must not alter the original object.

## Why copying matters

In a calculation pipeline, reusing a matrix as working storage can unexpectedly change subsequent results. Clone the original before editing, then apply operations to the copy. For simple numbers, cloning has little visible effect because numbers are already value-like.

## Matrix workflows

A common pattern is to clone a matrix, modify selected entries, and compare it to the source with [compare()](https://calcul.io/function/compare/index.md). Build or reshape data with [matrixFromColumns()](https://calcul.io/function/matrixFromColumns/index.md), extract a [column()](https://calcul.io/function/column/index.md), or duplicate a structure with [concat()](https://calcul.io/function/concat/index.md). For a deep structural test, use [deepEqual()](https://calcul.io/function/deepEqual/index.md).

## Practical expectation

clone() copies the value; it does not transform it or make an expression immutable forever. Use it before mutation, and verify the type you are copying when integrating with code that distinguishes arrays, matrices, and objects.

[All functions](https://calcul.io/functions/index.md)
