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 - 23 Mar 2007 16:25 GMT
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 -=
Lars Enderin - 23 Mar 2007 16:26 GMT
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;
Max - 23 Mar 2007 17:35 GMT
An explaination that makes more sense than mine. Ignore my
explaination. It doesn't exist.