How to compare a position of an object within an array

Hello, so i was trying to compare a position of an object within an array with an int variable that i have

I have this variable called stagePos, and i wanna use it to find an object that has the same value for its position in an array.

If the stagePos is 1, then i want to find an object that has the position of [1] in an array and do something with it as well as do something with the other object in that array because they don’t have the same value as stagePos

if(stage *!= stage[stagePos]){*

Vector3 pos = stage*.transform.position;*
pos += new Vector3(0f, -4f * Time.deltaTime , 0f);
stage*.transform.position = pos;*
stageScript.Invinsible(true);
}
else if(stage == stage[stagePos]){
Vector3 pos = stage*.transform.position;*
pos += new Vector3(0f, 4f * Time.deltaTime, 0f);
stage*.transform.position = pos;*
stageScript.Invinsible(false);

}
So that is the code, but i still can’t figure out on what do i need to do to compare it

Hello.

I’m not sure to understand you.

StagePos i an integrer? where it comes from?
You want to compare if stage position is the same as stage[stagePos] position?
Then just
if (stage*.transform.position == stage[stagePos].transformposition)*
or you need to find something like
¿which element from all stage[] objects have the same trasfrom as stage[stagePos]?
then do something like:
void findStageWithSamePos()
{
foreach (GameObject OneStage in stage[])
{
if (OneStage.transform.position == stage[stagePos])
{
// DO something here, because OneStage position will be same as stage[stagePos]
}

}