How can I perform an action within a for loop every 5 results?
for
Basically I'm just trying to emulate a table with 5 columns.
you could use the modulus operator
for(int i = 0; i < 500; i++) { if(i % 5 == 0) { //do your stuff here } }
2.1m questions
2.1m answers
60 comments
57.0k users