Question - Explain Ruby ranges. What are the ways to define ranges?
Answer -
Ruby range represents a set of values with a beginning and an end. They can be constructed using s..e and s...e literals or with ::new.
The ranges which has .. in them, run from beginning to end inclusively. The ranges which has ... in them, run exclusively the end value.
Ruby has a variety of ways to define ranges.
- Ranges as sequences
- Ranges as conditions
- Ranges as intervals