Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Array.sequence()

Create an ordered Array of Numbers given start and end values.

Signature

Array.sequence(from: Number, until: Number) => Array<Number>

Description

Create an ordered Array of integers beginning with provided start and end integers.

Parameters

Parameter Type Required Description

from

Number

Yes

Start of the sequence (inclusive). Must be an Int.

until

Number

Yes

End of the sequence (exclusive). Must be an Int.

Return value

Type Description

Array<Number>

Array of ordered integers.

Examples

Basic example

Array.sequence(1, 5)
[
  1,
  2,
  3,
  4
]

Equal start and end values

If the start and end values are equal, Array.sequence() produces an empty Array ([]).

Array.sequence(1, 1)
[]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!