VOOZH about

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

⇱ Ruby | Queue push() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue push() function

Last Updated : 12 Jul, 2025

The push() is an inbuilt function in Ruby inserts the element in the queue. 

Syntax: q_name.push(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-push
 

Comment