VOOZH about

URL: https://www.geeksforgeeks.org/ruby/ruby-queue-pop-function/

⇱ Ruby | Queue pop() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue pop() function

Last Updated : 12 Jul, 2025
The pop() is an inbuilt function in Ruby returns the element in the front of the queue and removes it from the queue.
Syntax: q_name.pop() Parameters: The function does not takes any element. Return Value: It returns the first element which is at the front of the queue and removes it from the queue.
Example 1: Output:
5
6
Example 2: Output:
12
21
Reference: https://devdocs.io/ruby~2.5/queue#method-i-pop
Comment