How to make a list and make the code shorter

Hi, I’m writing a code but it looks like I need to write the code for each player is there another way to make it shorter for multiple players what I want is if there is more than one player boolean that is true switch it to false for all the players, I hope that I explained my issue well.

public GrabController grab;
     public GrabController grab1;
 
     void Update()
     {
         if (grab1.isGrabed && grab.isGrabed)
         {
                 grab.isGrabed = false;
                 grab1.isGrabed = false;            
         }
 
     }

Generally, whenever you have multiple variables like this:

Thing something1
Thing something2
Thing something3

You can instead make an array like this:

Thing[] somethings

You can access the Elements of an Array with these: [ ], like so:

somethings[0].isGrabbed

And instead of a constant, you can use a Variable:

int index = 2;
somethings[index].isGrabbed

And this allows you to make a for loop, and using the loop counter variable as the index:

for (var i = 0; i < somethings.Length; i++)
{
    somethings*.isGrabbed ...*

}
Note how the loop is limited by the “Length” of the array, meaning the number of “list items” in it.