How can I perform an action within a for
loop every 5 results?
Basically I'm just trying to emulate a table with 5 columns.
How can I perform an action within a for
loop every 5 results?
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
}
}