How to loop to get all rigidbodies & rendercomponents?

Hello, I’m stuck in a project of mine. I would like to get all renders en rigidbodies from the objects stored in my array to be adressed at the same time when pressing space. If I do it now it will only work on 1 object in my array. I tried using a foreach loop, and i Hvave been playing around with creating new elements but it hasn’t worked out; Can anyone help me out ?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestArray : MonoBehaviour {
public GameObject myObjects;
bool Switch;
Rigidbody rigibod;
public bool canSwitch;
Renderer rend;

// Use this for initialization
void Start()
{
    myObjects = GameObject.FindGameObjectsWithTag("Block");
    for (int i = 0; i < myObjects.Length; i++)
    {
        rigibod=myObjects*.GetComponent<Rigidbody>();*

rend = myObjects*.GetComponent();*
}

Switch = true;
canSwitch = true;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) && canSwitch == true)
{ Switch = !Switch; }
if (Switch == true)
{
rend.enabled = false;
Physics.IgnoreLayerCollision(10, 12, true);
rigibod.useGravity = false;
rigibod.velocity = new Vector3(0, 0, 0);
}
if (Switch == false)
{ //GetComponent().enabled = false;
rigibod.useGravity = true;
rend.enabled = true;
Physics.IgnoreLayerCollision(10, 12, false);
}
}
}

hi;
the “rigibod” and “rend” are arrays too ?
if so then u have to make an array according to myObjects lenght then change the i value as u are finding them so the code will be change this way :

 void Start()
 {
     myObjects = GameObject.FindGameObjectsWithTag("Block");
rigibod = new Rigidbody[myObjects .Length];
rend =  new Renderer[myObjects .Length];

     for (int i = 0; i < myObjects.Length; i++)
     {
         rigibod _=myObjects*.GetComponent<Rigidbody>();*_

rend = myObjects*.GetComponent();*
}