Ever seen such a 'for' statement? If so, what's the output? (First commit, then try it out ;)
God I hope I'll never have to see this in production.
I can almost hear SonarQube weeping quietly in the background.
First for loop: i=0, j=0, increment =-1+1=0. Second for loop: i=1, j=2, increment = 0 +1= 1. Third for loop: i=2, j=4, increment = 1 + 1 = 2. No more for loops (j=6). Messy code FOR sure.
It doesn't compile because of only one & in condition rather than two, does it?
First time i saw a for-statement like this, with 2 counters.
Its 2 and the for statement that works here is something like this - for ( int j=0;j<5;j+=2) { increment++;}... so j would be 0 then 2 then 4 and increment will get to 2. Correct me if i m wrong.
United States Trends
- 1. Jokic 20.6K posts
- 2. Lakers 52.6K posts
- 3. #AEWDynamite 48K posts
- 4. Epstein 1.57M posts
- 5. Nemec 2,734 posts
- 6. Clippers 12.7K posts
- 7. Shai 15.7K posts
- 8. #NJDevils 2,945 posts
- 9. Thunder 41.4K posts
- 10. #Blackhawks 1,579 posts
- 11. Markstrom 1,110 posts
- 12. Nemo 8,453 posts
- 13. Sam Lafferty N/A
- 14. #Survivor49 3,847 posts
- 15. #AEWBloodAndGuts 5,739 posts
- 16. Ty Lue N/A
- 17. Steph 27.8K posts
- 18. Kyle O'Reilly 2,129 posts
- 19. Darby 5,611 posts
- 20. Rory 7,532 posts
Something went wrong.
Something went wrong.