Berserk Docs
Scalar FunctionsDynamic / JSON Functions

range

Generates a dynamic array of equally spaced values: start, start + step, … up to and including stop, at most 1048576 of them.

All-integer arguments give longs and any real argument gives reals. Datetime start and stop with a timespan step give datetimes; timespan start, stop and step give timespans; an integer step for time values counts 100ns ticks. The step defaults to 1 for numbers and 1h for datetimes and timespans. A zero step, or one pointing away from stop, gives null.

Syntax

range(start, stop, step)

Parameters

Prop

Type

Returns: dynamic

Syntax

range(start, stop, step)

Parameters

Prop

Type

Returns: dynamic

Syntax

range(start, stop, step)

Parameters

Prop

Type

Returns: dynamic

Syntax

range(start, stop, step)

Parameters

Prop

Type

Returns: dynamic

Syntax

range(start, stop, step)

Parameters

Prop

Type

Returns: dynamic

Examples

Example 1 — Every fiftieth year from 793 to 1066

print range(793, 1066, 50)
print_0 (dynamic)
[793,843,893,943,993,1043]

Example 2 — The day of the Lindisfarne raid in six-hour steps

print range(datetime(2024-06-08), datetime(2024-06-09), 6h)
print_0 (dynamic)
[2024-06-08T00:00:00Z,2024-06-08T06:00:00Z,2024-06-08T12:00:00Z,2024-06-08T18:00:00Z,2024-06-09T00:00:00Z]

Example 3 — Timespans from one to five hours, with the default 1h step

print range(1h, 5h)
print_0 (dynamic)
[01:00:00,02:00:00,03:00:00,04:00:00,05:00:00]

On this page