empty? is a String class method in Ruby which is used to check whether the string length is zero or not.
Parameters: Here, str is the given string which is to be checked.
Returns: It returns true if str has a length of zero, otherwise false.
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.