Want to learn?
Elixir Course Online | Prograils - Software Development Company
Ranges
Representation
The range is a discrete number of values where the first and last values are integers separated with two dots. It can be either increasing or decreasing. In most cases, you can make use of it whenever you need to iterate over a set of numbers.
iex> 1..5
1..5
iex> 5..1
5..1
It's worth to note that both ends of the range are also a part of it:
iex> range = 1..5
1..5
iex> Enum.member? range, 1
true
iex> Enum.member? range, 5
true