Elixir v1.0.5 Range

Defines a Range.

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 Kernel:

iex> range = 1..3
1..3
iex> first .. last = range
iex> first
1
iex> last
3

Summary

Functions

Creates a new range

Returns true if the given argument is a range

Types

t :: %Range{first: term, last: term}
t(first, last) :: %Range{first: first, last: last}

Functions

new(first, last)

Creates a new range.

range?(range)

Returns true if the given argument is a range.

Examples

iex> Range.range?(1..3)
true

iex> Range.range?(0)
false