VOOZH about

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

⇱ Ruby | Queue empty? function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Queue empty? function

Last Updated : 12 Jul, 2025
The empty? is an inbuilt function in Ruby checks if the queue is empty or not?. It returns a boolean value, which is true if the Queue is empty or it returns false.
Syntax: q_name.empty? Parameters: The function does not takes any element. Return Value: It returns true if the queue is empty else it returns false.
Example 1: Output:
false
true
Example 2: Output:
true
Reference: https://devdocs.io/ruby~2.5/queue#method-i-clear
Comment