What is a way to use for each on variables

i have a bunch of variables that will be used as counters for the win condition in a tic tac toe game.
What i dont know how to do is to create For Each statement in the function at the bottom that efficiently handles these variables.
My goal is to set all of the variables to zero.
(and if you have a better way to create these variables, then please explain or reference to post)


Also, i understand that a array can easily create these variables in a much smaller manner. But when i go to code, it may be confusing and i could mistype a number and it wont be as obvious. I also understand that i could set them as zero when they are declared. This question is more hypothetical in order to learn more about For Each statements.


Thank you for helping me :slight_smile:


public class AchiVar : MonoBehaviour {

static public int TLtBRX;
static public int BLtTRX;
static public int HorBotX;
static public int HorMidX;
static public int HorTopX;
static public int VertLeftX;
static public int VertCentX;
static public int VertRightX;

static public int TLtBRO;
static public int BLtTRO;
static public int HorBotO;
static public int HorMidO;
static public int HorTopO;
static public int VertLeftO;
static public int VertCentO;
static public int VertRightO;

static public void AchiVarReset()
{
    
}

}


THIS WAS TYPED AFTER THE ANSWER WAS GIVEN
This shows an alternative to using for each with a large number of variables

You can’t use a ForEach here. ForEach is used to iterate through a list, array or other type of collection.

If you are wanting to set all of those variables to 0, this is probably going to be the quickest way.

TLtBRX = BLtTRX = HorBotX = HorMidX = HorTopX = VertLeftX = VertCentX = VertRightX = TLtBRO = BLtTRO = HorBotO = HorMidO = HorTopO = VertLeftO = VertCentO = VertRightO = 0;

Hope this helps,
-Larry