Replace this line with your code.
Without the !, the string isn't changed.
Test it out for yourself with this code.
my_string = "string" my_string.capitalize puts my_string my_string.capitalize! puts my_string
You can do this:
my_string_2 = "string2" my_new_string = my_string_2.capitalize puts my_new_string
Thanks for your help , i will try it .
string isn't capitalized in the first case ( capitalize) but it was capitalized when i wrote ( capitalize!).Thank you !
so is this true?
var = var.upcase
And why isn't the ! introduced in the first lesson when upcase is introduced? Would one ever use it without the !?
Both of those will give you the same result. Whatever string is stored in var will be all uppercase.
A reason why you might not want to use ! is that you don't want to change your original value.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.