+ 1
May I know why we are getting same when we put put pre increment instead of post increment
4 Respuestas
+ 1
In a loop, counter increment does not concern whether the counter is pre or post incremented. What counts more (and oftenly skipped or forgotten somehow) is the counter not being incremented/decremented, causing the loop to be infinite.
+ 1
Thanks
+ 1
No problem 👌
0
It's not the same:
https://code.sololearn.com/cgYeI9eYRrCX/?ref=app
But the use cases are rare. Sometimes it's more about the performance, especially within very large loops you should prefer the pre-increment.