Skip to content

Intrinsic function: States.ArrayRange #477

@meenahoda

Description

@meenahoda

States.ArrayRange

Description from https://states-language.net/#appendix-b

Use the States.ArrayRange intrinsic function to create a new array containing a specific range of elements. The new array can contain up to 1000 elements.

This function takes three arguments. The first argument is the first element of the new array, the second argument is the final element of the new array, and the third argument is the increment value between the elements in the new array.

Input validation

You must specify integer values for all of the arguments.

You must specify a non-zero value for the third argument.

The newly generated array can't contain more than 1000 items.

For example, the following use of the States.ArrayRange function will create an array with a first value of 1, a final value of 9, and values in between the first and final values increase by two for each item:

json"array.$": "States.ArrayRange(1, 9, 2)"
Which would return the following array:

json{"array": [1,3,5,7,9] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions