Ruby | Enumerable entries() function

The entries() of enumerable is an inbuilt method in Ruby returns the items in the enumerable.

Syntax: enu.entries

Parameters: The function does not takes any parameter.



Return Value: It returns the items in the enum.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby program for entries method in Enumerable
  
# Initialize 
enu = [7, 9, 10]
  
# Prints each with object
enu.entries

chevron_right


Output:

[7, 9, 10]

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby program for entries method in Enumerable
  
# Initialize 
enu = (7..14)
  
# Prints each with object
enu.entries

chevron_right


Output:

[7, 8, 9, 10, 11, 12, 13, 14]
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : shubham_singh