The pop() function in Ruby is used to pop or remove the last element of the given array and returns the removed elements.
Elements : This is the number of elements which are to be removed from the end of the given array. If this parameter is not used then it removes and returns the single last element of the given array.
Returns: the removed elements.
7 [5, 6] [2, 3, 4] 
g ["f"] ["d", "e"] ["a", "b", "c"] 
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.