VOOZH about

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

⇱ Ruby | Queue deq() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue deq() function

Last Updated : 12 Jul, 2025
The deq() is an inbuilt function in Ruby returns the element in the front of the queue and removes it from the queue.
Syntax: q_name.deq() 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-deq
Comment