Skip to content

Commit 2fe7f7f

Browse files
authored
Update index.mdx
Replace broken internal link, fix a typo in that link and change paragraph on immutable Strings to avoid confusion
1 parent e052c1a commit 2fe7f7f

File tree

1 file changed

+5
-5
lines changed
  • content/tutorials/text/strings-and-drawing-text

1 file changed

+5
-5
lines changed

content/tutorials/text/strings-and-drawing-text/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ println(message.length());
6363
We can also change a String to all uppercase using the [toUpperCase()](http://processing.org/reference/String_toUpperCase_.html) method ([toLowerCase()](http://processing.org/reference/String_toLowerCase_.html) is also available).
6464

6565
```
66-
String uppercase = message.toUpperCase();
67-
println(uppercase);
66+
message = message.toUpperCase();
67+
println(message);
6868
```
6969

70-
You might notice something a bit odd here. Why didn't we simply say `message.toUpperCase()` and then print `message` variable? Instead, we assigned the result of `message.toUpperCase()` to a new variable with a different name—`uppercase`.
70+
You might notice something a bit odd here. Why didn't we simply say `message.toUpperCase()` and then print `message` variable? Instead, we set the variable `message` to be the result of `message.toUpperCase()`.
7171

72-
This is because a String is a special kind of object. It is immutable. An immutable object is one whose data can never be changed. Once we create a String, it stays the same for life. Anytime we want to change the String, we have to create a new one. So in the case of converting to uppercase, the method `toUpperCase()` returns a copy of the String object with all caps.
72+
This is because a String is a special kind of object. It is immutable. An immutable object is one whose data can never be changed. Once we create a String, it stays the same for life. Anytime we want to change the String, we have to create a new one. So in the case of converting to uppercase, the method `toUpperCase()` cannot modify the original String in `message`—it only returns a copy of the String object with all caps. We can however use the existing variable `message` to store the new String object.
7373

7474
Finally, let's look at [equals()](http://processing.org/reference/String_equals_.html). Now, Strings can be compared with the `==` operator as follows:
7575

@@ -503,7 +503,7 @@ class Letter {
503503
}
504504
```
505505

506-
The character by character method also allows us to display text along a curve. Before we move on to letters, let's first look at how we would draw a series of boxes along a curve. This example makes heavy use of [Trignometry](http://www.processing.org/learning/trig/).
506+
The character by character method also allows us to display text along a curve. Before we move on to letters, let's first look at how we would draw a series of boxes along a curve. This example makes heavy use of [trigonometry](https://processing.org/reference/#math-trigonometry).
507507

508508
[Example: Boxes along a curve](http://learningprocessing.com/examples/chp17/example-17-07-boxesoncurve)
509509

0 commit comments

Comments
 (0)