Elm Language Lists and Iteration Creating a list by range


Example

0.18.0

Prior to 0.18.0 you can create ranges like this:

> range = [1..5]
[1,2,3,4,5] : List number
>
> negative = [-5..3]
[-5,-4,-3,-2,-1,0,1,2,3] : List number
0.18.0

In 0.18.0 The [1..5] syntax has been removed.

> range = List.range 1 5
[1,2,3,4,5] : List number
>
> negative = List.range -5 3
[-5,-4,-3,-2,-1,0,1,2,3] : List number

Ranges created by this syntax are always inclusive and the step is always 1.