Range.new

You're seeing just the function new, go back to Range module for more information.

Specs

new(limit(), limit()) :: t()

Creates a new range.

If first is less than last, the range will be increasing from first to last. If first is equal to last, the range will contain one element, which is the number itself.

If first is greater than last, the range will be decreasing from first to last, albeit this behaviour is deprecated. Therefore, it is advised to explicitly list the step with new/3.

Examples

iex> Range.new(-100, 100)
-100..100
Link to this function

new(first, last, step)

View Source (since 1.12.0)

Specs

new(limit(), limit(), step()) :: t()

Creates a new range with step.

Examples

iex> Range.new(-100, 100, 2)
-100..100//2