VOOZH about

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

⇱ Ruby | Queue new() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue new() function

Last Updated : 12 Jul, 2025
The new() is an inbuilt function in Ruby creates a new queue of the given name.
Syntax: q_name = Queue.new() Parameters: The function does not takes any parameter. Return Value: It creates a new queue.
Example 1: Output:
1
2
Example 2: Output:
0
0
Reference: https://devdocs.io/ruby~2.5/queue#method-c-new
Comment