Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/content/docs/learning-course/stage0/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ These include:
Remainder: Returns the remainder of two numbers after division
</td>
<td>int, double</td>
<td>`a / b`</td>
<td>`a % b`</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -104,9 +104,9 @@ Without running the code, what is the value of `magicNumber`?
<summary>Answer</summary>
<div class="content">
<p>
`magicNumber`'s new value is 12. This is because `magicNumber` holds
the value 6. When multiplied by 2, 6 becomes 12, which is the new
value of `magicNumber`.
`magicNumber`'s value remains 6. The value calculated inside
`println` only affects what gets printed, since it's never assigned
back to `magicNumber` using an equal sign.
</p>
</div>
</details>
Expand Down Expand Up @@ -181,7 +181,7 @@ The main difference is that assignment operators are the shorthand version.
Using assignment operators can help make code easier to read.
It prevents having to write the variable name twice which can also be helpful in preventing code errors.

In the example below, we have variables `a` which is set to 10, and variable `b` which is set to 5. Since `+=` adds 1 to `a`, `a` will hold the value of 11. Similarly, `b` will now hold the value of 4
In the example below, we have variables `a` which is set to 10, and variable `b` which is set to 5. Since `+=` adds 2 to `a`, `a` will hold the value of 12. Similarly, `b` will now hold the value of 4
Comment thread
Adrianamm marked this conversation as resolved.

```java #arithmetic

Expand Down