+=

From Microduino Wiki
Revision as of 05:39, 17 August 2016 by Fengfeng (talk) (Created page with "+=(Compound addition) '''*Description'''<br> Arithmetic operator used between variables or constants. "+=" is an abbreviation. '''*Syntax'''<br> <pre style="color:gree...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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]