ruby - Multiple method calling -
this returns original name
.
name = "george" name.reverse.upcase! puts(name)
i'm wondering why , if there way tried above.
reverse
returns new string. upcase!
upcases string called on in-place. creating new reversed string, upcasing new string, , never using again.
if wanted reverse , upcase original string name.reverse!.upcase!
Comments
Post a Comment