Ranges in Ruby
Hey, How are you? In this article, you are going to talk about the Ruby object type for ranges. Now a range is going to typically be a range of numbers. Right, so let's say numbers from 1-10. Well, we could have an array that would contain all of those numbers or we could simply have a range which will say well, here is the starting point and here is the end point. It's from 1-10. Especially if we have something like 1- 1000, it makes a lot more sense to have something that just tells us the start and end point instead of trying to construct an array or something that has all 1000 numbers in it. We can use a range instead. And there are two kinds of ranges. Array vs Range There is the inclusive range and the exclusive range. And the notation is right there. That's how it works. It's just the first number and then either 2 or 3 dots depending on which one you want to use. ...