+ 1

When are increments best used?

2nd Oct 2020, 6:44 AM
Ryan Carandang
Ryan Carandang - avatar
2 Antworten
+ 2
You can use increment operation while using the variable for other calculations. Then you would practically merge 2 statements into 1. Sometimes it makes the code more readable, sometimes it doesn't.
2nd Oct 2020, 7:59 AM
Seb TheS
Seb TheS - avatar
0
To increase numbers. int num = 0; for(int i = 0; i < 5; i++) { // Increment num++; // Increment } System.out.println(num); // 5
2nd Oct 2020, 9:32 AM
Ore
Ore - avatar