learn.zybooks.com/zybook/EDU1COSC2801SEMESTER12023/chapter/2/section/5
1 Users
0 Comments
6 Highlights
0 Notes
Tags
Top Highlights
Special operators called compound operators provide a shorthand way to update a variable, such as userAge += 1 being shorthand for userAge = userAge + 1. Other compound operators include -=, *=, /=, and %=.
Style: Single space around operators
A good practice is to include a single space around operators for readability, as in numItems + 2, rather than numItems+2. An exception is minus used as negative, as in: xCoord = -yCoord. Minus (-) used as negative is known as unary minus.
Compound operators
No commas allowed
Commas are not allowed in an integer literal. So 1,333,555 is written as 1333555.
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.