Open In App

Ruby | SizedQueue max= function

Last Updated : 09 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
The max=() is an inbuilt function in Ruby changes the current capacity of the SizedQueue and sets it into X, where X is given by the user.
Syntax: sq_name.max=X() Parameters: The function accepts a single mandatory parameter and changes the current size of the SizedQueue to X. Return Value: It sets the current size of the SizedQueue to X.
Example 1: CPP
#Ruby program for max() function in SizedQueue

#Create a new SizedQueue q1
sq1 = SizedQueue.new(3)

#Prints the max size
          puts sq1.max

#Changes the max size
              sq1.max
    = 2

#Prints the new max size
      puts sq1.max
Output:
3
2
Example 2: CPP
#Ruby program for max() function in SizedQueue

#Create a new SizedQueue q1
sq1 = SizedQueue.new(3)

#Prints the max size
          puts sq1.max

#Changes the max size
              sq1.max
    = 4

#Prints the new max size
      puts sq1.max
Output:
3
4
Reference: https://devdocs.io/ruby~2.5/sizedqueue#method-i-max-3D

Next Article

Similar Reads