Increment and decrement is the most useless syntax in java. Why are we need it while we have addition | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
- 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 šŸ‘ŒšŸ‘Œ

24th Apr 2018, 4:11 PM
Huį»³nh Quį»‘c Tuįŗ„n
Huį»³nh Quį»‘c Tuįŗ„n - avatar
3 Respostas
+ 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?
24th Apr 2018, 4:43 PM
Paul
0
I thought it must have been ++i, mustn't it
25th Apr 2018, 4:07 AM
Huį»³nh Quį»‘c Tuįŗ„n
Huį»³nh Quį»‘c Tuįŗ„n - avatar
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
25th Apr 2018, 5:47 AM
Paul