Range operation
Learn how to generate a sequence of values.
The range operation creates a sequence of values between two endpoints, much like a for-loop in programming languages.
Ranges have the following properties:
- They have no gaps, so each value in the sequence is one increment away from the next value.
- They are inclusive, which means that both the start and end values are included as part of the sequence, and the sequence cannot be empty.
- They can be ascending or descending, depending on the order of the start and end values.
You can create ranges of integers, characters, and local dates. Ranges of other types, such as floating-point numbers and multi-character strings, are not supported.
Ranges are currently limited to a maximum length of 30, so any attempt to create a longer range will result in an error.
To create a range, use the .. operator between the start and end values:
/*<start>*/ .. /*<end>*/
For example, the following range generates a sequence of integers from 1 to 3:
1 .. 3 // 1, 2, 3
Because ranges have direction, you can also create a descending range by reversing the start and end values:
3 .. 1 // 3, 2, 1
You can also create ranges of characters, like this:
'A' .. 'C' // A, B, C
In fact, you can use any Unicode character, including emojis:
'😃' .. '😆' // 😃, 😄, 😅, 😆
The sequence of characters in a range is determined by their Unicode code points. Refer to the Unicode character list for more information.
Finally, you can create a range of local dates by specifying the start and end dates in the ISO 8601 format:
'2025-05-08' .. '2025-05-10' // 2025-05-08, 2025-05-09, 2025-05-10
For more examples of valid date formats, see date conversion.