This section contains 725 words (approx. 3 pages at 300 words per page) |
The compound assignment is a form of assignment statement used to perform multiple operations on variables and expressions. An assignment statement assigns a value to a variable, in the form of variable=expression; the expression can be a constant, another variable, or an arithmetic calculation. With compound assignments the equals sign (=), also called the operator, is interpreted by the computer as "takes the value of" in executing the assignment statement, and compound assignment statements are thereby able to perform more than one operation on a variable.
For example, a multiplication assignment operator (*=) is a compound assignment operator used to direct the multiplication of the value of a variable by the value of an expression. The result of this operation is then assigned to the variable (i.e., becomes the new result). The operational sequence (result*=expression) involves any variable or expression and is identical to specifying...
This section contains 725 words (approx. 3 pages at 300 words per page) |