Changing a value in a C# script in a list Objects

My main script:

public class Take_Cover : MonoBehaviour {
        public float heath = 100f;
        public float rangecover = 3f;
        public GameObject[] cov;
        public GameObject cov_target = null;
    void searchtarget()
    {
      cov = GameObject.FindGameObjectsWithTag("Cover");
      if ( cov.Length > 0 && cov_target == null)
      {
             foreach (GameObject co in cov)
                  if ( in this, i wanna check value "cover" in co's Rock script and if it's true)
                   {
                            cov_target = co;
                            set value "cover" in co's Rock script to false;
                    }
      }
    }

And Rock script:

 public class Rock : MonoBehaviour {
        public bool cover = true;

Thank!

if(co.GetComponent().cover){
cov_target = co ;
co.GetComponent().cover = false ;
}

use

GetComponent<YourScript>()

to get the reference and do whatever you want directly.

Also, you can save it in a variable first

Rock r = co.GetComponent<Rock>() ;
if(r.cover){
        cov_target = co ;
        r.cover = false ;
}