+ 1

increment a loop

why is that when you use x++ in the for-loop during incrementing gives a different result unlike using x+1.

12th Sep 2019, 5:43 PM
Victor Yegon
Victor Yegon - avatar
3 Respuestas
+ 1
x+1 doesn't increase the value of the variable x. ++x does. So when your loop depends on x increasing, the first method wouldn't give you what you want.
12th Sep 2019, 8:47 PM
HonFu
HonFu - avatar
0
Can you post an example?
12th Sep 2019, 5:47 PM
Anthony Johnson
Anthony Johnson - avatar
0
x+=1 increments the loop
12th Sep 2019, 9:57 PM
Dejan Francuz🥇
Dejan Francuz🥇 - avatar