The Range
class describes the interval. The range object
is created by the range operator (..
or ...
).
The range object created by ..
operator include end.
The range object created by ...
operator
does not include end.
For example:
for i in 1..5
...
end
iterates over 1 to 5, including 5. On the other hand, 1...5
iterates over 1 through 4.
The both operands for the range operator must be comparable with
<=>
opeator. In addition they must have
succ
method for each
operation.
Note That an interval contains both ends.