Stringing together methods

What am I missing with this code to get it to run if I remove the comment from the end and run that as code?
When I run this with the method string commented out, it provides the expected results. When I make the last line code instead of comment, this is the error I receive: undefined method `method1’ for “Melinda”:String
Did you mean? method

I have tried to define each method as a String, and it gives me a different error. Any guidance would be great. Thanks!!!

name = “Melinda”

method1 = name.upcase
puts method1

method2 = name.downcase
puts method2

method3 = name.reverse
puts method3

#puts name.method1.method2.method3

Link to exercise, please. Thanks.

1 Like

The reverse step is number 2, not 3.

The calls on the individual objects is not where I am having trouble. I can not get the combined methods to work. I adjusted the code to put the methods in the same format as suggested. It does not change that the output does not function. The methods each produce the expected outcome. When I remove the comment and try to run the last line, it throws the error.

What you have are three strings, not methods. That is why they cannot be chained.


Thank you. Changing that got it to run. I was taking the example too literally.