- 1
Increment and decrement is the most useless syntax in java. Why are we need it while we have addition
I'm not native and not good at english 👌👌
3 Réponses
+ 1
for(int i = 0; i < n; i++)
if(++i == g)
i--;
now without pre and post incrementation and decrementation:
for(int i =0; i < n; i = i + 1)
if((i = i + 1) == g)
i = i - 1;
and you cant even talk about pre of post here since you only want addition. For loop are also useless cause you can just copy and paster your code N times tho, right?
0
I thought it must have been ++i, mustn't it
0
it is all about pre and post increment that is crucial and you just simply can't do some of them in one line using addition or substraction, so that is why they are uaeful