34,333
edits
Changes
→Ruby Sequence Ranges
<pre>
('cab'..'car').to_a
=> ["cab", "cac", "cad", "cae", "caf", "cag", "cah", "cai", "caj", "cak", "cal", "cam", "can", "cao", "cap", "caq", "car"]
</pre>
Range values may also be objects. The only requirements for placing an object in a range is that the object provides a mechanism for returning the next object in the sequence via ''succ'' and it must be possible to compare the objects using the <=> operator.
== Using Range Methods ==