Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    Question 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() {
    ??
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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? :-)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    x+=N;
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    assignment, yea, 10x for replay
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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