reverse is a String class method in Ruby which is used to return a new string with the characters from the given string in reverse order.
Parameters: Here, str is the string which is to be reversed.
Returns: This method returns a new string in reversed order.
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.