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!