Skip to content

Fix example on Operator Precedance #16 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2023
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
6 changes: 4 additions & 2 deletions src/integers/operator_precedence.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ None of this should be a surprise if you learned [PEMDAS](https://www.khanacadem

```java
// Following the order of operations:
// 2 * 3 + 3 * 9 / 2 - 2

// 2 * 3 happens first
// 6 + 3 * 9 / 2 - 2
Expand All @@ -18,11 +19,12 @@ None of this should be a surprise if you learned [PEMDAS](https://www.khanacadem
// 6 + 27 / 2 - 2

// 27 / 2 happens next
// because of int division, that gives 13
// because of int division, that gives 13
// (ignores float point number .5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this parenthetical line.

  • its floating point not float point
  • The int division line above is already explaining that.

We should say integer division though, since that is what we call it in previous sections

// 6 + 13 - 2

// 6 + 13 comes next
// 19 - 7
// 19 - 2

// and the final result is 17;
int result = 2 * 3 + 3 * 9 / 2 - 2;
Expand Down