Skip to content

Tag Archives: Ruby Range-class

The == is an inbuilt method in Ruby returns boolean value true if both the given ranges are equal, else it returns false. Syntax: range1… Read More
The === is an inbuilt method in Ruby returns boolean value true if the given object lies in the range, else it returns false. Syntax:… Read More
The begin() is an inbuilt method in Ruby returns the first element of the given range. Syntax: range1.begin() Parameters: The function accepts no parameter Return… Read More
The end() is an inbuilt method in Ruby returns the last element of the given range. Syntax: range1.end() Parameters: The function accepts no parameter Return… Read More
The cover?() is an inbuilt method in Ruby returns a boolean value true if the given object lies within the given range, else it returns… Read More
The entries() is an inbuilt method in Ruby returns an array containing all elements of the given range. Syntax: range1.entries() Parameters: The function accepts no… Read More
The each() is an inbuilt method in Ruby iterates over every element in the range. Syntax: range1.each(|el| block) Parameters: The function accepts a block which… Read More
The eql?() is an inbuilt method in Ruby returns boolean value true if both the given ranges are equal, else it returns false. Syntax: range1.eql?(range2)… Read More
The exclude_end?() is an inbuilt method in Ruby returns boolean value true if the range excludes its end value, else it returns false. Syntax: range1.exclude_end?… Read More
The new() is an inbuilt method in Ruby returns a new range of numbers. Syntax: range1.new(first, last) Parameters: The function accepts first and last which… Read More
The to_s() is an inbuilt method in Ruby returns a string containing the given range. Syntax: range1.to_s() Parameters: The function accepts no parameter. Return Value:… Read More
The to_a() is an inbuilt method in Ruby returns an array containing the numbers in the given range. Syntax: range1.to_a() Parameters: The function accepts no… Read More
The size() is an inbuilt method in Ruby returns the size of the range. It returns the number of elements in the range. Syntax: range1.size()… Read More
The last() is an inbuilt method in Ruby returns an array of last X elements. If X is not mentioned, it returns the last element… Read More
The first() is an inbuilt method in Ruby returns an array of first X elements. If X is not mentioned, it returns the first element… Read More