Calling "Capitalize!"


I'm just wondering, but when I do ...

last_name = gets.chomp
last_name2 = last_name.capitalize!

it has the same effect as
last_name = gets.chomp.capitalize!

The second way of coding is easier, and I'm not sure if it works with other things as well, but do you know if I should use the second way I found to code? Thanks!


Try entering some text that is capitalized already. Now check the outputs.


Ohh! You're right, it does effect the output! Thanks so much! :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.