Ruby | Range entries() function Last Updated : 18 Dec, 2019 Improve Improve Like Article Like Save Share Report 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 parameter. Return Value: It returns an array containing all elements of the given range. Example 1: # Ruby program for entries() # method in Range # Initialize range range1 = (0..10) # Stores in array arr = range1.entries() # Prints elements puts arr Output: 0 1 2 3 4 5 6 7 8 9 10 Example 2: # Ruby program for entries() # method in Range # Initialize range range1 = (2..4) # Stores in array arr = range1.entries() # Prints elements puts arr Output: 2 3 4 Like Article Suggest improvement Previous Ruby | clear() function Next Ruby | Range cover?() function Share your thoughts in the comments Add Your Comment Please Login to comment...