...

View Full Version : increment by 2 ?



Kor
07-16-2003, 12:14 PM
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() {
??

Kor
07-16-2003, 12:50 PM
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? :-)

Vladdy
07-16-2003, 12:53 PM
x+=N;

Kor
07-16-2003, 01:08 PM
assignment, yea, 10x for replay



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum