+=

From Microduino Wiki
Jump to: navigation, search

+=(Compound addition)


*Description
Arithmetic operator used between variables or constants. "+=" is an abbreviation.


*Syntax

x += y;   //  It is equal to x = x + y;
x -= y;   //  It is equal to x = x - y; 
x *= y;   //  It is equal to x = x * y; 
x /= y;   //  It is equal to x = x / y; 


*Parameters
x: Variable in any data type
y: Variable or constant in any data type


*Example

x = 2;
x += 4;      // x = 6
x -= 3;      // x = 3
x *= 10;     // x = 30
x /= 2;      // x = 15

[Return to Arduino Syntax Manual]