How to set bool on every gameobject in my list

Hello, I want to make my game object move up and down but not every single one in the list lets say every third. I get an idea to do that with bool set bool on every game object on spawn and count when its third on the role set to true next two false and repeat that.

in some script

for(i=0;i<max;i++) {
   mylistofgameobjects*.flag = (i%3 == 0);*

}
in the gameobjects script:
Update() {
if flag == true
moveup
else
movedown
}