The Range type holds a 'from', 'to' and 'step' value, such that one can iterate from 'from' to 'to' by steps of 'step'. Negative step values may be provided for integers and floats.

The '..' operator may be used as a shortcut for specifying a new Range.

# The space before .. prevents confusing 1 with the Float 1.
1 .. 4        # equivalent to: +Range(1,4)
1 .. 5 .. 2   # equivalent to: +Range(1,5,2)

Ranges are useful for 'each' loops and interval matches. Range works on any type of value, so long as it implements these two methods: .Incr(step) for incrementing the value and .'<=>'(to) for comparing two values of that type.

Class Methods (see Type)

(from, to, step) Creates a new Range. The default for an unspecified 'step' is 1 (when 'from' is an Integer), 1.0 (when 'from' is a Float), and null otherwise.


Returns true if the matched value is of the proper type and the value is between 'from' and 'to' inclusive. Otherwise, it returns false.
Creates an iterator (closure) through the range of values. Every call of the closure will return two values: either true and the iterated value or else null, null if the iterated value exceeds 'to'. Assigning a value to the closure resets the current value of the iterator.
Get or set this range's 'from' value.
Get or set this range's 'step' value.
Get or set this range's 'to' value.