How to perform an action every 5 results?

you could use the modulus operator

for(int i = 0; i < 500; i++)
{
    if(i % 5 == 0)
    {
        //do your stuff here
    }
}

Leave a Comment