Elixir v1.5.0 Range View Source
Defines a range.
A range represents a discrete number of values where the first and last values are integers.
Ranges can be either increasing (
first <= last) or
first > last). Ranges are also always
A range is represented internally as a struct. However,
the most common form of creating and matching on ranges
is via the
../2 macro, auto-imported from
iex> range = 1..3 1..3 iex> first..last = range iex> first 1 iex> last 3
iex> range = 1..10 1..10 iex> Enum.reduce(range, 0, fn i, acc -> i * i + acc end) 385 iex> Enum.count(range) 10 iex> Enum.member?(range, 11) false iex> Enum.member?(range, 8) true