Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: increment by 2 ?

1. ## increment by 2 ?

can i increment a variable by 2, or 3 or whichever (not by one, as usualy, say, i++) ?

and (somehow linked problem), which is the simpliest way to calculate an array variable sum? (of course, not by simply adding +, 'cose actually I have a very long array)

var bla = newArray(10)
bla[0]= 45678;
bla[1]= 342;
bla[2]= 56466;
.
.
.
bla[10]= 5656;

function calculatesum() {
??

• As a matter of fact I knew all the time :-)

function calculatesum(){
var total = 0;
for(i=0;i<=2;i++){
total = total + bla[i];
}
}

... the ideea is that initially i used
total = 0;

Ns6 agree with, but IE6 give error message, so I have to use
var total = 0;

Anyway tx all :-)) Yet... can I increment a variable by 2? :-)

• x+=N;

• assignment, yea, 10x for replay

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•