Data can be expressed in the form of a range using Ruby Ranges (in other words a data set with start and end values and a logical sequence of values in between). Numbers, characters, strings, and objects can all be used as range values.
The range operators ".." and "..." are used by Ruby to produce these sequences. The two-dot form provides a range that is inclusive, but the three-dot form creates a range that is exclusive of the provided high value.
The range() function returns a number series that starts at 0 and increments by 1 (by default) before stopping at a specified value.
In contrast to xrange(), the range() method returns a list or sequence of numbers and requires more memory. When compared to a list or tuple, the range() method consumes less memory regardless of the range it covers because it simply keeps the start, stop, and step values.
Share With Friend
Have a friend to whom you would want to share this course?
Download LearnVern App
Code Scan
or
Download the app
598K+
Downloads
4.57
Avg. Ratings
15K+
Reviews
Learn anywhere on the go
Get regular updates about your enrolled or new courses
Share content with your friends
Evaluate your progress through practice tests
No internet connection needed
Enroll for the webinar and join at the time of the webinar from anywhere
Enjoying this course!
All the Courses on Learnvern are Free! So Register/Sign in to
have Access all the Courses and Videos.