Creating Ranges
Inclusive and exclusive ranges.
What Is a Range?
A Range represents a sequence between a start and an end value. Write it with two dots: 1..5.
r = 1..5
puts r
puts r.classInclusive Ranges
Two dots make an inclusive range that includes the end value. 1..5 covers 1, 2, 3, 4, 5.
puts (1..5).to_a.inspect