Skip to content
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

Small edit for clarity. #6

Merged
merged 1 commit into from
Jan 30, 2021
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
9 changes: 5 additions & 4 deletions en/chapter-02/contents.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ is not 7. Parentheses must be used to alter the order of evaluation:
@smalltalkExample{1 + (2 * 3)
@result{} 7}


However, for clarity of understanding we may want to them even
when not needed. In the Spacewar! code snippet below, the parentheses
are superfluous make code easier to read:
Parenthesis can also be used to make potentially confusing code more
clear. For example, the strict left to right evaluation order can be
confusing when applied to mathematical expressions. In the Spacewar!
code snippet below, the parentheses make it more clear that the
addition happens first:

@smalltalkExampleCaption{Ship velocity,updateShipVelocity,
newVelocity @assign{} (ai + ag) * t + velocity}
Expand Down