VOOZH about

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

⇱ Ruby | Queue enq() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue enq() function

Last Updated : 12 Jul, 2025
The enq() is an inbuilt function in Ruby inserts the element in the queue.
Syntax: q_name.enq(element) Parameters: The function takes the element to be inserted into the queue. Return Value: It inserts the element into the queue.
Example 1: Output:
5
6
Example 2: Output:
10
12
13
Reference: https://devdocs.io/ruby~2.5/queue#method-i-enq
Comment