Count
Syntax
count($stop)
count($start, $stop)
count($start, $stop, $step)
Description
Creates a list with numbers from start (inclusive) to stop (exclusive). If only one argument is specified, start is automatically set to 0. If the optional argument step is specified, this determines the increment between the numbers in the list.
Parameters
| name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
| start | Number | The start value of the count. The number will be added to the list. | no | 0 |
| stop | Number | The end value of the count. The number won't be added to the list. | yes | |
| step | Number | The increment to be used for counting up. Only whole numbers are permitted, although these can also be negative. | no | 1 (start < stop), -1 (start > stop) |
Return value
Type: Set
A set with all the numbers in the count.
Examples
Count without increment
count(10)
Output: A list with the elements [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].
Counting with increment
count(10, step: 2)
Output: A list with the elements [0, 2, 4, 6, 8].
Counting with negative increment
count(10, 0, -2)
Output: A list with the elements [10, 8, 6, 4, 2].
Descending count
count(10, 0)
Output: A list with the elements [10, 9, 8, 7, 6, 5, 4, 3, 2, 1].