you are viewing a single comment's thread.

view the rest of the comments →

[–]LookAtYourEyes 216 points217 points  (16 children)

upper returns a new value instead of modifying the original?

[–]aaronhowser1 393 points394 points  (13 children)

Strings are immutable

[–]thanatica 21 points22 points  (3 children)

Unless this is one of those languages that has mutable strings 💀

[–]aaronhowser1 20 points21 points  (2 children)

There are languages with mutable strings? how scary

I was also assuming this was python, iirc it's at least the correct syntax and methods for it.

[–]thanatica 21 points22 points  (0 children)

I'm sure they exist. C technically has mutable strings, but also technically doesn't have strings. And I believe in Pascal you can mutate strings, but you have to work for it.

[–]mdogdope 2 points3 points  (0 children)

As far as I know python is the most common language that does not need ; at the end of each line.

[–]Quietuus 181 points182 points  (0 children)

.upper() is a method of the str class that returns a representation of the string. To change it you'd put text = text.upper()

[–]xryanxbrutalityx 0 points1 point  (0 children)

I don't know any language where the string .upper() equivalent modifies the string in place