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

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -