The length() is an inbuilt method in Ruby returns the size of the Set. It returns the number of elements in the set.
Parameters: The function does not accepts any parameter.
Return Value: It returns the size of the set.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.