# range() Function & Examples

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

## range

#### start:end

#### start:step:end

#### range(start, end)

#### range(start, end, step)

#### range(string)

Try it yourself:

```calculio
1:5
3:-1:-3
range(3, 7)
range(0, 12, 2)
range("4:10")
range(1m, 1m, 3m)
a = [1, 2, 3, 4; 5, 6, 7, 8]
a[1:2, 1:2]
```

[concat](https://calcul.io/function/concat/index.md)

[det](https://calcul.io/function/det/index.md)

[diag](https://calcul.io/function/diag/index.md)

[identity](https://calcul.io/function/identity/index.md)

[inv](https://calcul.io/function/inv/index.md)

[ones](https://calcul.io/function/ones/index.md)

[size](https://calcul.io/function/size/index.md)

[squeeze](https://calcul.io/function/squeeze/index.md)

[subset](https://calcul.io/function/subset/index.md)

[trace](https://calcul.io/function/trace/index.md)

[transpose](https://calcul.io/function/transpose/index.md)

[zeros](https://calcul.io/function/zeros/index.md)

---

## range(): Building Number Sequences

**range()** creates a sequence of values, usually from a start to an end with an optional step. It is useful for indices, sample positions, grids, and repeatable test data.

## Endpoints and steps

Specify a step whose sign can reach the endpoint: a positive step cannot traverse downward. A zero step is invalid because it never progresses. Check output length with [size()](https://calcul.io/function/size/index.md), then transform values using [map()](https://calcul.io/function/map/index.md) or aggregate them with [sum()](https://calcul.io/function/sum/index.md).

Decimal steps can accumulate floating-point error. For exact indexed loops, create integer positions then scale them with [multiply()](https://calcul.io/function/multiply/index.md). Use [randomInt()](https://calcul.io/function/randomInt/index.md) instead when the goal is sampling rather than enumeration.

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