Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intrinsic function: States.ArrayRange #477

Open
meenahoda opened this issue Oct 17, 2023 · 0 comments
Open

Intrinsic function: States.ArrayRange #477

meenahoda opened this issue Oct 17, 2023 · 0 comments

Comments

@meenahoda
Copy link
Member

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] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant