Skip to main content
1 of 2
Jay Kominek
  • 632
  • 5
  • 11

As of 1.0, toUpperCase() modifies the string in place rather than returning a new one.

However I don't see the reason why the example code doesn't compile.

The thing to note on the help page is that it says "Returns: none". Since the method invocation returns nothing, and you can't assign "nothing" to a string, you get that (somewhat unhelpful) error.

The solution is to simply omit the assignment, as the method invocation itself has done everything you hoped to do, and end up with this line of code:

stringOne.toUpperCase();

Jay Kominek
  • 632
  • 5
  • 11