Pattern based if statements?

Curious if there is a simple way to do this

byte comparison = 5;
byte count = 1;
while(1)
{
   if ( count == *divisible by* comparison)
   {
      //do the thing
   }
   count++;
}

Have a timer that reports an incremented byte "about" every 10ms. However one of the instructions would be better executed every 50ms.

modulo .. (see reference)

Thought about modulo right after I posted and face palmed...

Anyhow I'll post when I have something working, so this wasn't a complete waste of space

void setup()
{
  Serial.begin(9600);
  spacerTimer(1);
}

void loop()
{
  if(byte progress = spacerTimer(0))
  {
    if(progress % 5 == 0)
    {
      Serial.println(progress);
    }
  }
}

byte spacerTimer(byte reset)
{
#define DELAYTIME 1 //the delay time corresponds to action values
#define TIMESTARTED 0 // Denotes when each action starts
#define SPACER 100 // ms
  static uint32_t timer[2] = {};// holds time started and delay time
  static byte progress=0; //keeps the progress of the actions 

  if(reset)
  {
    progress=0;//set everything back to the begining
    timer[DELAYTIME]=SPACER; //set the intial timing
    timer[TIMESTARTED]=millis();  // note the start time of the transition
  }
  else if(millis() - timer[TIMESTARTED] > timer[DELAYTIME])
  { 
    progress++;//increment the progress of the time table
    timer[DELAYTIME]=SPACER; //set duration based on progress level
    timer[TIMESTARTED]=millis();  // note the start time of the transition
    return progress; //return which level of progress has elapsed
  }
  return 0;// in most cases this function is called, time will yet to be elapsed 
}

Yeah this was pretty simple, sorry

Maybe "this was pretty simple", but I don't understand this line:

if(byte progress = spacerTimer(0))

He's both creating a new variable and assigning to it and testing for 0 at the same time. If spaceTimer(0) returns 0 then 0 gets assigned and the if doesn't run. If spaceTimer(0) returns anything non-zero then the assignment will be of that value and evaluate as true sending you into the conditional block.

Yeah.. what Delta_G said.

C++ has all these funny sort of short-cuts that I'm finding all over the place. I probably should avoid them in the interest of making the code more readable. The problem is more lines of code equals more to read which also works against readability. If I was working on a smaller problem would probably stick with keeping the assignment and the condition testing separate.