5.8. Compound Assignment Operators
Visual Basic provides several compound assignment operators for abbreviating assignment statements. For example, the statement
value = value + 3
can be abbreviated with the addition assignment operator, += as
value += 3
The += operator adds the value of the right operand to the value of the left operand and stores the result in the left operand’s variable. Any statement of the form
variable = variable operator expression
can be written in the form
variable operator= expression
where operator is one of the binary operators +, -, *, ^, &,/ or \, and variable is an lvalue (“left value”). An lvalue is a variable or property that can appear on the left side of an assignment statement. We will learn how to ...
Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.