Back to Developer Roadmap

Ranges

src/data/roadmaps/ruby/content/ranges@OHq_172eTWaVlxES7Ccfc.md

4.0703 B
Original Source

Ranges

Ranges in Ruby are used to create a sequence of values. They are defined using two endpoints, which can be numbers, characters, or any objects that can be compared using the <=> operator. Ranges can be inclusive (including the last value) or exclusive (excluding the last value), denoted by .. and ... respectively. They are commonly used for iterating over a sequence, creating subsets of arrays, and checking if a value falls within a specific interval.

Visit the following resources to learn more: