Created
October 13, 2012 14:42
-
-
Save FerPerales/3884860 to your computer and use it in GitHub Desktop.
Mutable strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = "Hello " | |
s = s + "rubyCUCEI!" #New object "Hello rubyCUCEI!" | |
puts s | |
s = s.capitalize #New object "Hello rubycucei!" | |
puts s | |
r = "Hello " | |
r += "rubyCUCEI!" #New object "Hello rubyCUCEI!" | |
puts r | |
r.capitalize! #Same object "Hello rubycucei" | |
puts r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment