More actions
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
<br> | <br> | ||
<source lang="javascript">number a = 1; | |||
<source lang="">number a = 1; | |||
number b; | number b; | ||
b = ++a; | b = ++a; | ||
Line 27: | Line 26: | ||
b = --a; | b = --a; | ||
print(b); // 1 | print(b); // 1 | ||
print(a); // 1</source> | print(a); // 1</source> | ||
| |
Revision as of 07:48, 14 September 2011
Array : The array object
++x is pre-increment and --x is pre-decrement
x++ is post-increment and x-- is post-decrement
With ++x and --x: means x is incremented BEFORE being used.
With x++ and x--: means x is incremented AFTER being used.
Examples
number a = 1;
number b;
b = ++a;
print(b); // 2
print(a); // 2
b = --a;
print(b); // 1
print(a); // 1
number c = 3;
number d;
d = c++;
print(d); // 3
print(c); // 4
d = c--;
print(d); // 4
print(c); // 3