## Ranges

A Range is an ordered sequence of integers that are equally spaced apart. For example, "1, 2, 3" is a range, as is "5, 8, 11, 14". To create a range in Scala, use the predefined methods `to`, `until`, and `by`. `1 to 3` generates "1, 2, 3" and `5 to 14 by 3` generates "5, 8, 11, 14".

If you want to create a range that is exclusive of its upper limit, then use `until` instead of `to`: `1 until 3` generates "1, 2".

Note that `Range(a, b, c)` is the same as `a until b by c`

Ranges are represented in constant space, because they can be defined by just three numbers: their start, their end, and the stepping value. Because of this representation, most operations on ranges are extremely fast.

A range's upper bound is not inclusive:

``````val someNumbers = Range(0, 10)

second should be(res1)
last should be(res2)``````

Ranges can be specified using 'until':

``````val someNumbers = Range(0, 10)
val otherRange = 0 until 10

Range can specify a step for an increment:

``````val someNumbers = Range(2, 10, 3)

second should be(res1)
last should be(res2)``````

A range does not include its upper bound, even in a step increment:

``````val someNumbers = Range(0, 34, 2)
``````val someNumbers = Range(0, 34).inclusive
``````val someNumbers = Range(0, 34).inclusive