Incrementation

Discussion in 'Java' started by Max, Mar 23, 2007.

  1. Max

    Max Guest

    Is there a way to increment by more than one in Java? I know it can be
    done in C (as I read a book about it, haven't actually used it), but I
    can't find anything about it in Java.
    Max, Mar 23, 2007
    #1
    1. Advertising

  2. Max

    Max Guest

    Never mind, I figured it out.

    If you find this thread years later thinking that it'll have an
    answer, try i += n, where i is what is incrementing and n is the
    amound. Decrement is similar, use -=
    Max, Mar 23, 2007
    #2
    1. Advertising

  3. Max

    Lars Enderin Guest

    Max skrev:
    > Is there a way to increment by more than one in Java? I know it can be
    > done in C (as I read a book about it, haven't actually used it), but I
    > can't find anything about it in Java.
    >

    Like in C: Use +=

    foo = foo + anything;
    is equivalent to
    foo += anything;

    int foo = 17;
    foo += 99;
    Lars Enderin, Mar 23, 2007
    #3
  4. Max

    Max Guest

    On Mar 23, 11:26 am, Lars Enderin <> wrote:

    An explaination that makes more sense than mine. Ignore my
    explaination. It doesn't exist.
    Max, Mar 23, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf Hildebrandt

    Re: Nested For Loop incrementation

    Ralf Hildebrandt, Jul 2, 2003, in forum: VHDL
    Replies:
    3
    Views:
    3,459
    Aaron McFarland
    Jul 3, 2003
  2. everett

    Variable name incrementation

    everett, Feb 13, 2004, in forum: C++
    Replies:
    3
    Views:
    421
    Jon Bell
    Feb 13, 2004
  3. Petterson Mikael

    Confusing incrementation

    Petterson Mikael, Sep 6, 2006, in forum: XML
    Replies:
    0
    Views:
    387
    Petterson Mikael
    Sep 6, 2006
  4. sam
    Replies:
    4
    Views:
    306
    Andre Kostur
    Jun 26, 2007
  5. Replies:
    4
    Views:
    295
    santosh
    Apr 26, 2008
Loading...

Share This Page