Array.sequence()

Create an ordered array of integers, given start and end values.

Signature

Array.sequence(start: Int, end: Int): Array

Description

Create an ordered array of integers, beginning with start (inclusive) and ending with end (exclusive).

The end value must be greater than or equal to start. The difference between start and end can’t exceed 16,000.

Parameters

Parameter Type Required Description

start

Int

Yes

Start of the sequence (inclusive).

end

Int

Yes

End of the sequence (exclusive).

Return value

Type Description

Array

Array of ordered values from start (inclusive) to end (exclusive).

Examples

Basic example

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

Equal start and end values

If start and end 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!